Results 1 to 2 of 2
  1. #1
    mchadwick is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Sep 2011
    Posts
    71

    Adjust this VBA code to include an image header

    Hello, I have this VBA code I'm using to create an email in MS Access O365 to send to users from outlook. I would like to add an image header to it, it would be on the very top of the body. How can I go that?



    Private Sub Command28_Click()

    Dim Msg As String

    Msg = "Hello " & [Pref_First] & ",<P>" & _
    "Your SRS Windows Login account will be migrated on " & [Date of Migration] & "."

    Dim O As Outlook.Application
    Dim M As Outlook.MailItem

    Set O = New Outlook.Application
    Set M = O.CreateItem(olMailItem)

    With M
    .BodyFormat = olFormatHTML
    .HTMLBody = Msg
    .To = [Email - Primary Work]
    .Subject = "Domain\Tenant Migration - User Migration"
    .Display

    End With

    Set M = Nothing
    Set O = Nothing

    End Sub

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,896
    Use <IMG> tag, either when building Msg string or concatenate to Msg variable.

    Like:

    .HTMLBody = "<IMG src= C:\Users\Owner\June\MyStuff\CanceledCheck.jpg width=100 height=100><br>" & Msg
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Moving an image in a grouped header
    By KillGorack in forum Access
    Replies: 13
    Last Post: 10-19-2022, 10:43 AM
  2. Include date range criteria in Report Header?
    By templeowls in forum Reports
    Replies: 2
    Last Post: 10-07-2020, 08:36 AM
  3. MS Access - Graphing, Adjust scale via code
    By ironfelix717 in forum Forms
    Replies: 12
    Last Post: 03-20-2020, 12:02 AM
  4. Help! Header Logo Image on form won't print.
    By DjMorgan in forum Access
    Replies: 8
    Last Post: 04-29-2013, 06:46 AM
  5. Replies: 9
    Last Post: 04-21-2013, 05:37 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums