Outlook到Excel的超链接问题 [英] Outlook to Excel hyperlink issue
本文介绍了Outlook到Excel的超链接问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
希望您可以帮助我了解我在这里做错的事情.
Hoping you can help me understand what i am doing wrong here.
作为Outlook宏的一部分,我希望使用指向文档的超链接来更新excel中的单元格.
As part of my Outlook macro, i am looking to update a cell in excel with a hyperlink to a document.
'~~> Excel variables
Dim oXLApp As Object, oXLwb As Object, oXLws As Object
'~~> Establish an EXCEL application object
On Error Resume Next
Set oXLApp = GetObject(, "Excel.Application")
'~~> If not found then create new instance
If Err.Number <> 0 Then
Set oXLApp = CreateObject("Excel.Application")
End If
Err.Clear
On Error GoTo 0
'~~> Show Excel
oXLApp.Visible = True
'~~> Open the relevant file
Set oXLwb = oXLApp.Workbooks.Open("V:\Dir\filename.xls")
'~~> Set the relevant output sheet. Change as applicable
Set oXLws = oXLwb.Sheets("Outstanding")
oXLws.Range("R11").Select
oXLws.Range("R11").Hyperlinks.Add Anchor:=Selection, Address:= _
"V:\Dir\" & emailsub & ".msg" _
, TextToDisplay:="Here"
由于某种原因,它只能进行调试,因此代码可以从excel正常工作,因此我必须缺少一些内容,请帮忙!
For some reason it just debugs, the code works fine from excel, so i must be missing something, please help!
干杯,Dom
推荐答案
由于使用Excel进行后期绑定,Outlook无法理解什么是Selection
Since you are latebinding with Excel, Outlook doesn't understand what is Selection
更改这些行
oXLws.Range("R11").Select
oXLws.Range("R11").Hyperlinks.Add Anchor:=Selection, Address:= _
"V:\Dir\" & emailsub & ".msg", TextToDisplay:="Here"
收件人
oXLws.Range("R11").Hyperlinks.Add Anchor:=oXLws.Range("R11"), Address:= _
"V:\Dir\" & emailsub & ".msg", TextToDisplay:="Here"
这篇关于Outlook到Excel的超链接问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文