简体   繁体   English

如何从 Excel vba 添加到 email body 的多个超链接

[英]How to add multiple hyperlinks to email body from Excel vba

I have been googling for an answer for this for 2 weeks now I have clicked on every link there is maybe I am not asking the right way.我已经在谷歌上搜索了 2 周的答案,现在我点击了每个链接,也许我没有问正确的方法。
In Sheet17.Range("AC" & Lastrow & ":" & "AM" & Lastrow) I have some hyperlink address not all of those cells are filledSheet17.Range("AC" & Lastrow & ":" & "AM" & Lastrow)我有一些超链接地址,但并非所有这些单元格都已填充
I am trying to get these address into my email body as separate clickable link.我试图将这些地址作为单独的可点击链接放入我的 email 正文中。 I would love to have the name only but would be happy for the link.我很想只知道名字,但很高兴有链接。

This is my email body这是我的 email 身体

   xStrBody = "Hi there:" & NRes & "<br>" _
                & emailfrm.Body & "<br>" _
         & "Click <a href=""https://form.jotform.com/202217530090846"">here</a> to ..."

This works for the one I have hardcoded but I don't know how to get the ones from the cells in there.这适用于我硬编码的代码,但我不知道如何从其中的单元格中获取这些代码。
At this stage I am prepared to change my worksheet to make it easier to get the links in the email even if I have to put in another separate worksheet在这个阶段,我准备更改我的工作表,以便更容易获得 email 中的链接,即使我必须放入另一个单独的工作表

Dim c As Range, lnk, nm

xStrBody = "Hi there:" & NRes & "<br>" & emailfrm.Body & "<br>" 

for each c in Sheet17.Range("AZ2:AZ" & Lastrow).Cells
    nm = c.value
    lnk = c.EntireRow.Cells(1, "BA").Value
    
    xStrBody = xStrBody & "<a href=""" & lnk & """>" & nm & "</a><br>"

next c

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM