通过VBA将图像放置在电子邮件中

时间:2020-09-03 14:43:58

标签: vba image outlook ms-word

我有一个宏代码,用于在excel Activesheet中的电子邮件正文中附加图片。 我的问题是:

  1. 是否可以将图片放在“谢谢”行上方?
  2. 如果我要插入第二张图片,如何修改代码,以便将Picture2放置在Picture1的下面(当前它位于Picture1的右边)

有什么想法吗?

         Sub create_email_2()
         Dim oApp As Outlook.Application
         Dim email As Outlook.MailItem

         Dim inspect As Outlook.Inspector
         Dim content As Object

         Set oApp = New Outlook.Application
         Set email = oApp.CreateItem(olMailItem)
         With email
         .To = "magic@gmail.com"
         .Subject = "E-mail2"
         .htmbody = "Hello" & "</p>" _
         & "Please see bellow current status" & "</p>" _
         & "Thank you" & "</body></html>"

         .Display
         Set inspect = email.GetInspector
         Set content = inspect.WordEditor

         ActiveSheet.Pictures(1).Copy
         content.Application.Selection.Start = Len(.Body)
         content.Application.Selection.Paste

         'ActiveSheet.Pictures(2).Copy
         'content.Application.Selection.Start = Len(.Body)
         'content.Application.Selection.Paste
          .Save
         '.Send
         End With

         End Sub

0 个答案:

没有答案