Share via

VBA Excel Outlook Coding - inserting an image does not work for GMail Users -Very Urgent

Anonymous
2019-06-27T06:15:02+00:00

Dear Team,

I have written a code to send mails to People who uses outlook or gmail. This particular Macro work well if I send mail to outlook user and he can view the image in body but if I send the same mail to gmail user then uses is not able to see the image. Can anyone look into this and resolve my problem asap.

Here is my code:

With mitem

.To = toMail

.cc = Sheet2.Cells(i, "I").Value

.Subject = Sheet1.Range("b2").Value

 .HTMLBody = "<body>Dear Sir/Madam," & "<img src=" & "'" & pPath & "'/> Regards,LearnExcelMacro.com </body>"

.send

End With

Here: pPath is the variable I used to store the full path of image.

Regards,

Arvind

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

OssieMac 48,001 Reputation points Volunteer Moderator
2019-06-28T08:35:20+00:00

Further to my previous post, I have been performing some testing and I have identified that there is a problem with gmail displaying the image.

It prompted me to Display the message instead of just sending it because I wanted to ensure that the image was in the email before it sent. Having done this and then sent, it worked and the image was visible in the gmail.

Therefore I inserted a .Display line before the send and it works fine.

.To = toMail

.cc = Sheet2.Cells(i, "I").Value

.Subject = Sheet1.Range("b2").Value

 .HTMLBody = "<body>Dear Sir/Madam," & "<img src=" & "'" & pPath & "'/> Regards,LearnExcelMacro.com </body>"

.Display

.Send

End With

I thought that it might be that the Send is too fast for the image to display in Outlook mail before it was sending so I inserted a Wait command before the send but to no avail.

Was this answer helpful?

3 people found this answer helpful.
0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Anonymous
    2019-06-28T09:22:46+00:00

    Thanks a ton, You guys are awesome. Thank u very much..

    *******

    Regards,

    Arvind

    Was this answer helpful?

    2 people found this answer helpful.
    0 comments No comments
  2. OssieMac 48,001 Reputation points Volunteer Moderator
    2019-06-27T06:58:03+00:00

    Have a look at the following link. It might be the receiver has images turned off. If so, provide instructions to user as to how to enable images.

    https://support.google.com/mail/answer/145919?co=GENIE.Platform%3DDesktop&hl=en

    Was this answer helpful?

    0 comments No comments