从具有 Excel VBA 的文本单元格发送具有指定 Bold/Size/Color/Underline 文本格式的电子邮件

Send Email With Specified Bold/Size/Color/Underline Text Format from a Text Cell with Excel VBA

我正在尝试发送 Outlook 电子邮件,更改 Excel 中特定单元格中特定文本的文本格式。

例如,在我的工作表中有一个包含文本“Jorge Bailey”的单元格,我想将其从“Jorge Bailey”编辑为 Jorge Bailey

Sub enviar_email_gestor_maquina()

Set objeto_outlook = CreateObject("Outlook.Application")

Set Email = objeto_outlook.createitem(0)

Email.display

Email.to = "jorge.bailey@syngenta.com"

Email.Subject = "Seu Notebook esta Elegível a Troca - Renovação Tecnológica"
       
Link = "<span style=""font-family:Arial; font-size: 12pt; ""<a href=""https://app.smartsheet.com/b/form/3976fc184fc84380a68d0da69b8ddc6d"" >Link Formulário</a>"
   
txt1 = "<span style=""font-family:Arial; font-weight:bold; color: #808000; font-size:20pt;"">Renovação Tecnológica - Troca de notebook</span>" & "<br><br>"
 
txt2 = "<span style=""font-family:Arial; font-size: 15pt;""> & Range(B5) & </span>"

Email.htmlbody = txt1 & htmltxt2 & Link & Email.htmlbody
Email.Recipients.ResolveAll

End Sub

“txt2”有什么问题?**

Hyperlinks 怎么样?

我想用 HYPERLINKS 来做,因为当你从电子邮件正文的单元格中输入 link 时,VBA 获取文本而不是 hyperlink.

您引用的内容不正确:

Set objeto_outlook = CreateObject("Outlook.Application")

Set Email = objeto_outlook.createitem(0)

Email.display

Email.to = "jorge.bailey@syngenta.com"

Email.Subject = "Seu Notebook esta Elegível a Troca - Renovação Tecnológica"
       
txt1 = "<span style='font-family:Arial; font-weight:bold; color: #808000; font-size:20pt;'>" & _
         "Renovação Tecnológica - Troca de notebook</span><br><br>"
 
txt2 = "<span style='font-family:Arial; font-size: 15pt;'><b>" & Range("B5").Value & "</b></span>"
 
Link = "<span style='font-family:Arial; font-size: 12pt;'>" & _
   "<a href='https://app.smartsheet.com/b/form/3976fc184fc84380a68d0da69b8ddc6d'>Link Formulário</a></span>"

Email.htmlbody = txt1 & txt2 & Link & Email.htmlbody
Email.Recipients.ResolveAll