Outlook saveas did not save the embedded image added from vba or build manually

Simon G364 5 Reputation points
2024-03-18T12:10:11.8433333+00:00

Hi folks,

We run a vba code that create email using data from an Acess database.

We add some picture using html format for the email and save it in Outlook format(msg) to read them later.

When I display it, we see the image inside the email.

After using the saveas statement, the image is not present in the file previously saved.

When the email is in display mode, if I do a saveas manually of the same email into a file, we don't see neither the image inside.

It seems to be specific to some Outlook version.

My version is : Outlook, version 2401, build 17231.20194.

Some previous versions are working well as we see the image in the saved email.

I am running on Windows 10, french Enterprise.

Version 21H2

Installation date : 2023-04-03

OS version : 19044.4046

Experience: Windows Dfeature Experience pack 1000.19053.1000.0

Any help would be greatly appreciate.

Regards,

Sub EmailDemo()

Dim appOutlook As Outlook.Application

Dim mimEmail As Outlook.MailItem

Dim strEmailAddress As String

Dim strFirstName As String

Dim strLastName As String

Dim strPicPath As String

Set appOutlook = New Outlook.Application

Set mimEmail = appOutlook.CreateItem(olMailItem)

strEmailAddress = "someemail@domain.com"

strPicPath = "c:\temp\image_we_want_to_add.png"

If (Dir("C:\temp\test.msg") <> "") Then

Kill "C:\temp\test.msg"

End If

With mimEmail

.To = strEmailAddress

.Subject = "Email image test"

.Attachments.Add strPicPath, 1, 0

.HTMLBody = "<html><h2>Reminder</h2><p>Lorem ipsum dolor sit amet....</p>" & _

"<img src=""image_we_want_to_add.png""></html>"

.Display

.SaveAs "C:\temp\test.msg", olMSG

End With

End Sub

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,989 questions
Access Development
Access Development
Access: A family of Microsoft relational database management systems designed for ease of use.Development: The process of researching, productizing, and refining new or existing technologies.
881 questions
0 comments No comments
{count} vote

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.