1

I am trying to link a PNG file as image source for a signature - to send e-mail using vba. I am trying to adjust the size of the signature (PNG Image) as well trying to understand what a Single Quote and Double quote refers to. I need image size to be Height - 1.96 cm and width - 16.37 cm. Please advise.

 "<img src ='" & relativepath1 & "'>" **<--- This one works but signature is too big** 

"<img src='Image1.png'" & "width='500' height='400'>" **<-- Too small. And Image doesn't load**

Sub Mail_workbook_Outlook_1()

relativepath1 = ThisWorkbook.Path & Application.PathSeparator & "Signature99" & ".png"

'Create a new email message
Set OutlookMessage = OutlookApp.CreateItem(0)

On Error Resume Next
With OutlookMessage
'.Attachments.Add "C:\ Image1.PNG", olByValue, 0
.To = Prime_Email
.cc = cc1
.BCC = ""
.Subject = "Donor Volume - " & " " & str2 & "(" & Subject & ")"
.HTMLBody = RangetoHTML(Range("E2:N16")) & "<img src ='" & relativepath1 & "'>"
.send
'.Display
End With
On Error GoTo 0
Set OutlookMessage = Nothing
Set OutlookApp = Nothing
End Sub
  • Try `""` or `` You may want to see https://www.w3schools.com/html/html_images.asp – Siddharth Rout Jun 26 '21 at 07:13
  • 1
    You may also have to use `relativepath1` instead of `Image1.png` if the image still doesn't load. Maybe because it is not able to find the image. For example `""` or `` – Siddharth Rout Jun 26 '21 at 07:17
  • @SiddharthRout .. It doesn't work. It still throws me an error "File not found / file moved to a different location". – Fabian Julian Jun 27 '21 at 14:19
  • Can you share the final code that you are using including the value of `relativepath1` ? – Siddharth Rout Jun 28 '21 at 05:03
  • @SiddharthRout.. Actually resizing the signature worked. But its blurry (When resized). But if the image size can be adjusted it would be helpful. I have added the code to the Question. – Fabian Julian Jun 28 '21 at 16:02

0 Answers0