您好我正在尝试创建一个可以发送带有多个嵌入图像的邮件的宏。我想在每个图像中添加不同的URL并将其作为单个图像嵌入到表中。一旦用户点击单个图像的这些不同部分,它应该将他引导到它的相应网站。请帮我解决vba宏代码。
我想将上述代码作为我的代码的扩展,在下面给出的问题或代码粘贴在这里。
How to Change width and height of embedded image in mail using Cell values
提前致谢。
Sub SendMail()
Dim olApp As Object
Dim olMail As Object
For I = 2 To Sheet1.Cells(Rows.Count, 1).End(xlUp).Row
With ws
Set olApp = CreateObject("Outlook.Application")
Set olMail = olApp.CreateItem(olMailItem)
End With
With olMail
.To = Cells(I, 2).Value
.cc = Cells(I, 3).Value
.bcc = Cells(I, 4).Value
.Subject = Cells(I, 5).Value
.Body = Cells(I, 6).Value
On Error Resume Next
.Attachments.Add Cells(I, 7).Value
.HTMLBody ="<HTML><center> <img src ="""&Cells(I,10).Value&"""width="""&Cells(I, 8).Value&""" height=""" & Cells(I, 9).Value & """ ><br>"
On Error GoTo 0
.Display
.Send
End With
Next
Set olMail = Nothing
Set olApp = Nothing
MsgBox "Mails Sent Successfully"
End Sub