Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys, i have the following code
It adds the chart to the body of the e-mail which is great but adds the actual text rather than the html code. Can anyone help me here? I'd like to add the html code and then the chart
try like that:
Sub Email_Test
Set myApp = CreateObject ("Outlook.Application")
Set myMessage = myApp.CreateItem(olMailItem)
newfile = "C:\Users\Admin\Desktop\123.xlsx"
myMessage.body = ("EmailBody")
myMessage.HTMLBODY = "<font face = " & Chr(34) & "Calibri" & Chr(34) & ">Hi, <BR> <BR>" & _
"<BR> <BR> Please use this link to the new file: <a href=" &_
Chr(34) & newfile & Chr(34) & ">Click here</a> <BR> </font>"
'myMessage.Attachments.Add("C:\Users\Admin\Desktop\123.xlsx") 'If you want to attach a file
myMessage.BodyFormat = 2 'HTMLFormat
myMessage.To = "test@test.com"
myMessage.Subject = "New file"
Set myInspector = myMessage.GetInspector 'add signature to e-mail
Set myDoc = myInspector.WordEditor
ActiveDocument.GetSheetObject("CH46").CopyBitmapToClipboard
myDoc.Range(0,0).PasteSpecial False, False, 0, False, 5
myInspector.WordEditor.Content.InsertBefore chr(13)
myInspector.WordEditor.Content.InsertBefore chr(13)
myInspector.WordEditor.Content.InsertBefore EmailBody & chr(13) & chr(13)
myMessage.Display
Set myMessage = Nothing
Set myApp = Nothing
Set myInspector = Nothing
Set myDoc = Nothing
End sub
try like that:
Sub Email_Test
Set myApp = CreateObject ("Outlook.Application")
Set myMessage = myApp.CreateItem(olMailItem)
newfile = "C:\Users\Admin\Desktop\123.xlsx"
myMessage.body = ("EmailBody")
myMessage.HTMLBODY = "<font face = " & Chr(34) & "Calibri" & Chr(34) & ">Hi, <BR> <BR>" & _
"<BR> <BR> Please use this link to the new file: <a href=" &_
Chr(34) & newfile & Chr(34) & ">Click here</a> <BR> </font>"
'myMessage.Attachments.Add("C:\Users\Admin\Desktop\123.xlsx") 'If you want to attach a file
myMessage.BodyFormat = 2 'HTMLFormat
myMessage.To = "test@test.com"
myMessage.Subject = "New file"
Set myInspector = myMessage.GetInspector 'add signature to e-mail
Set myDoc = myInspector.WordEditor
ActiveDocument.GetSheetObject("CH46").CopyBitmapToClipboard
myDoc.Range(0,0).PasteSpecial False, False, 0, False, 5
myInspector.WordEditor.Content.InsertBefore chr(13)
myInspector.WordEditor.Content.InsertBefore chr(13)
myInspector.WordEditor.Content.InsertBefore EmailBody & chr(13) & chr(13)
myMessage.Display
Set myMessage = Nothing
Set myApp = Nothing
Set myInspector = Nothing
Set myDoc = Nothing
End sub
Can we add the text and then the chart?
I got it
myDoc.Range(len(EmailBody),len(EmailBody)).Paste
Thanks for your help again!