Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

adding charts in email body via macro

Hi,

I have the following macro:


Sub Email() 'HOW DO I GET MULTIPLE CHARTS TO PASTE IN THE EMAIL BODY???

Set myOutlook = CreateObject ("Outlook.Application") 
Set myMessage = myOutlook.CreateItem(olMailItem)
Set obj = ActiveDocument.GetSheetObject("CH08")
captiontext = obj.GetCaption.Name.v

myMessage.BodyFormat = 2 'HTMLFormat

myMessage.To = "address@host.com
myMessage.Subject = "test"
myMessage.Body = captiontext &":"'"Trades with NPV diffs > $1,000" 
'chr(13)

Set myInspector = myMessage.GetInspector  
Set myDoc = myInspector.WordEditor

'myInspector.WordEditor.Content.InsertBefore chr(13)
'myInspector.WordEditor.Content.InsertAfter chr(13) 

obj.CopyTableToClipboard TRUE

myDoc.Range(1,1).Paste   'Do I have to specify a range or can i just have it pasted after the last chr(13)?

myMessage.Display


Set myMessage = Nothing 
Set myApp = Nothing
Set myInspector = Nothing
Set myDoc = Nothing 
   
End sub

It works fine if i'm just pasting one chart into the body of my email, but how do i paste multiple charts into the body of my email?

0 Replies