如何在电子邮件VBA Excel中插入链接

我已经创build了一个macros,在条件满足时向某些人发送电子邮件。 但是,在电子邮件正文中,我想插入Link而不是http://blabla.com

你知道我怎么能做到这一点?

链接在我的单元格B4上,这是下面的代码。

 Public Sub email_missing_forecast() Application.ScreenUpdating = False 'Déclaration des variables derniereligne = Range("B5000").End(xlUp).Row Project_number = Cells(1, 2).Value Project_name = Cells(2, 2).Value Project_due = Cells(3, 2).Value lien = Cells(4, 2).Value Dim Objoutlook As New Outlook.Application Dim Objectmail 'Condition For i = 6 To derniereligne Adresse = Cells(i, "D").Value Adresse2 = Cells(i, "E").Value Adresse3 = Cells(i, "F").Value If Cells(i, "B").Value = "No" Then Set Objoutlook = New Outlook.Application Set Objectmail = Outlook.createitem(olmailitem) With Objectmail .To = Adresse & ";" & Adresse2 & ";" & Adresse3 .Subject = "Bobbi Brown | " & Project_number & " " & Project_name & " | Forecast due " & Project_due .Body = "Dear All, " & Chr(10) & Chr(10) & "I kindly remind you that forecasts for program " & Project_number & " " & Project_name & " are due " & Project_due & "." & Chr(10) & Chr(10) & "Please enter your forecast at the link below." & Chr(10) & Chr(10) & lien & Chr(10) & Chr(10) & "Best Regards," & Chr(10) & "Christian Chen" .Send End With End If Next i Application.ScreenUpdating = True MsgBox "Your e-mails have been sent successfully", , "FIY" End Sub 

HTML正文可以用来得到这个。 请在您的代码中使用下面的行。 在下面input这些行Set Objectmail = Outlook.createitem(olmailitem)

 strbody = "Dear All, " & Chr(10) & Chr(10) & "I kindly remind you that forecasts for program " & Project_number & " " & Project_name & " are due " & Project_due & "." & Chr(10) & Chr(10) & "Please enter your forecast at the link below." & Chr(10) & Chr(10) & lien & Chr(10) & Chr(10) & "Best Regards," & Chr(10) & "Christian Chen" 

一旦你input上面的行,只需删除

.Body = "Dear All, " & Chr(10) & Chr(10) & "I kindly remind you that forecasts for program " & Project_number & " " & Project_name & " are due " & Project_due & "." & Chr(10) & Chr(10) & "Please enter your forecast at the link below." & Chr(10) & Chr(10) & lien & Chr(10) & Chr(10) & "Best Regards," & Chr(10) & "Christian Chen" .Body = "Dear All, " & Chr(10) & Chr(10) & "I kindly remind you that forecasts for program " & Project_number & " " & Project_name & " are due " & Project_due & "." & Chr(10) & Chr(10) & "Please enter your forecast at the link below." & Chr(10) & Chr(10) & lien & Chr(10) & Chr(10) & "Best Regards," & Chr(10) & "Christian Chen"

.HTMLBody = StrBody & "<a href=""" & ActiveSheet.Range("B4") & """ >Name your link</a>"