如何在电子邮件VBA Excel中插入链接 [英] How to insert a link in an e-mail VBA Excel

查看:204
本文介绍了如何在电子邮件VBA Excel中插入链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个宏,当条件满足时,该宏将电子邮件发送给某些人。但是,在电子邮件的正文中,我想插入一个链接,例如 链接 而不是 http://blabla.com

I have created a macro that sends e-mails to certain people when a condition is filled. However, In the body of the e-mail I would like to insert a link like so Link instead of http://blabla.com.

您知道我该怎么做吗?

链接位于我的单元格B4上,是以下代码。

The link is on my cell B4, and this is the following code.

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正文可用于获取此信息。请在代码中使用以下几行。在Set Objectmail = Outlook.createitem(olmailitem)

HTML body can be used to get this. Please use the below lines in your code. enter these lines below 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"

键入以上几行后,只需删除

Once you type the above lines, just remove

.Body =亲爱的所有人,& Chr(10)& Chr(10)& 我谨在此提醒您,该节目的预测是&项目编号和&项目名称和名称到期 Project_due& 。 & Chr(10)& Chr(10)& 请在下面的链接中输入您的预测。 & Chr(10)& Chr(10)&留置权Chr(10)& Chr(10)& 最好的问候, Chr(10)& Christian Chen
并添加

。HTMLBody= StrBody& < a href =& ActiveSheet.Range( B4)& >命名您的链接< / a>

这篇关于如何在电子邮件VBA Excel中插入链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆