Question

Ok, I have been working on this for a while now with no progress, so I'll toss it to you guys. I am writing a program in VBA for Excel that sends emails to customers. I would like to vary the images that the email sends out. The only working way I've found to embed images is to reference a site like imgur.com and embed it into an HTML email.

The code I am trying to make work is:

emailBody = emailBody & "<img src='Worksheet("Coupon Page").Cells(D, i).Value'/>" & "<br/>"

It should add an image from the link in cell (D,i); where D is the column title and i is the variable that determines the image. It is throwing errors when it hits the double quotes (") on Coupon Page saying it is expecting the end of the expression. I'm not sure how to proceed here. I don't know how else to make the image vary based on the variable i. Any thoughts or ideas would be very much appreciated!

Thanks!

Was it helpful?

Solution

emailBody = emailBody & "<img src='" & _
           Worksheet("Coupon Page").Cells(D, i).Value & "'/><br/>"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top