Insert signature already made in macro VBA

Asked

Viewed 80 times

0

I would just like to insert a signature made in Outlook itself with image and text in this VBA, but I do not know how. Follow the code:

Sub Aplicacao_Fundo()

Dim OutlookApp As Object, OutlookMail As Object
Dim email As String, assunto As String, corpo As String

Set OutlookApp = CreateObject("Outlook.Application")

Set OutlookMail = OutlookApp.CreateItem(0)

email = ActiveSheet.Range("B4").Value

assunto = "CONFIRMAÇÃO DE ORDEM - " & ActiveSheet.Range("B3").Value & "(" & ActiveSheet.Range("B2").Value & ")"

corpo = Worksheets("Texto").Range("A1").Value

With OutlookMail
    
    .to = email
    .CC = ""
    .BCC = "[email protected]"
    .Subject = assunto
    .Body = corpo
    .Display ' para envia o email diretamente defina o código  .Send
    

    
    
End With

Set OutlookMail = Nothing

Set OutlookApp = Nothing

    
End Sub

1 answer

0


Try adding the following to the email code. Adjust as needed:

  Const MyPath = "C:\Assinatura\"
  Const MyPicture = "Assinatura1.jpg"
  With CreateObject("Outlook.Application").CreateItem(0)
    .Attachments.Add MyPath & MyPicture
     .HTMLBody = "<html><p>This is a picture</p>" & _
                "<img src=cid:" & Replace(MyPicture, " ", "%20") & " height=240 width=180>" & _
                 "<p>Melhores cumprimentos,</p>" & _
                "<p>" & UCase(Environ("USERNAME")) & "</p></html>"
    .Display
  End With

Browser other questions tagged

You are not signed in. Login or sign up in order to post.