【问题标题】:Outlook to Excel hyperlink issueOutlook 到 Excel 超链接问题
【发布时间】:2013-10-10 15:39:08
【问题描述】:

希望你能帮助我理解我在这里做错了什么。

作为 Outlook 宏的一部分,我希望使用指向文档的超链接来更新 excel 中的单元格。

'~~> 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 中运行良好,所以我一定遗漏了一些东西,请帮忙!

干杯,多姆

【问题讨论】:

    标签: excel vba outlook


    【解决方案1】:

    由于您使用 Excel 进行后期绑定,Outlook 无法理解 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"
    

    【讨论】:

      猜你喜欢
      • 2021-07-29
      • 1970-01-01
      • 2010-09-23
      • 2020-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多