我有一个excel电子表格,使用vba发送电子邮件:
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "This is email text, click the link <a href='C:\test.xlsm & Range("F" & ActiveCell.Row).Address'></a>"
On Error Resume Next
With OutMail
.To = "####"
.CC = ""
.BCC = ""
.Subject = "Sales Tracker: A New Task has been added to the tracker"
.HTMLBody = strbody & strbody2 & strbody3 & strbody4
.Send 'displays outlook email
'Application.SendKeys "%s" 'presses send as a send key
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
当用户单击活动行中的特定单元格时,将发送电子邮件 .
我在电子邮件中包含我的Excel电子表格,其中包含超链接,但现在我想在发送电子邮件时 be able to add something to the hyperlink which will allow me to include the cell reference of the row the user click on .
这样的想法是打开时的超链接将打开电子表格,并将用户带到链接引用的行并突出显示它 .
请有人告诉我该怎么做?提前致谢
2 回答
您缺少链接中工作表的引用(即使我不确定这是否足够),请尝试这样的方法:
匹配这种格式:
更重要的是,你忘了正确地关闭引号,所以在这里:
我不确定是否可以用超链接来做,很可能不是 . 我想到的只是将Worksheet_Activate()事件添加到您附加的电子表格中,并指向您希望的范围,但不包含超链接 .