Results 1 to 8 of 8

Thread: Including HTML Code in Email Body

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    Administrator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,302
    Location
    Here is another example where the signature is captured from the display before it is then sent with the signature:

    Sub test()    
        Dim OApp As Object, OMail As Object, signature As String
        
        Set OApp = CreateObject("Outlook.Application")
        
        For x = 1 To 5
            Set OMail = OApp.CreateItem(0)
            With OMail
                .Display
                DoEvents
            End With
            signature = OMail.HTMLBody
            With OMail
                .to = "jbloggs@somebusiness.com"
                .Subject = "Subject here"
                .HTMLBody = "Body text here" & vbNewLine & signature
                .Send
            End With
        Next x
        
        Set OMail = Nothing
        Set OApp = Nothing
    End Sub
    Last edited by georgiboy; 06-17-2022 at 08:03 AM.
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved
    Click here for a guide on how to upload a file with your post

    Excel 365, Version 2408, Build 17928.20080

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •