VBA在不使用HTML正文的情况下在电子邮件正文中插入链接?
问题描述:
我想在我通过excel VBA创建的电子邮件正文内插入一个链接。该链接每天都在变化,因此我已将其值放入单元格B4中。但是,我没有找到用该链接发送电子邮件的正确方法。VBA在不使用HTML正文的情况下在电子邮件正文中插入链接?
这是我使用的代码:
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
Link = 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 this link below." & Chr(10) & Chr(10) & Link & 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
答
只有两种可能性恕我直言:
- 纯文本电子邮件:NO可点击的链接,可以
- 的HTML电子邮件:可点击的链接是可能的,格式良好的HTML WITH
<body
>标记是必要的!
+1
好的,谢谢。我会将其更改为HTML电子邮件 – MopMop
你得到的错误是什么? – duDE
resp。有什么问题? – Andre
参见例如[this](http://www.mrexcel.com/forum/excel-questions/605342-adding-hyperlink-email-body-visual-basic-applications.html)或[this](http://answers.microsoft .COM/EN-US/MSOFFICE /论坛/ msoffice_excel-msoffice_custom /创建-A-超链接功能于VBA的时候,送的电子邮件/ 1bcfc62f-0455-4aae-ABBF-eb60e6b65aa4)。 – dee