Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Static Report as Email Body Not as Attachment using Macros

Dear Folks,

              Good Morning to all.  I have the Static report with four Charts. Now i want that four chart as EMail body not as attachment. If Possible please give the code using VB Macros ASAP. I have checked this for more than a month. still i didn't find.

Sakthivel.S

Gurgaon

6 Replies
Not applicable
Author

Hi Sakthi,

Try this

Not applicable
Author

Dear Uday,

          Thanks for your reply. But the Problem is i am asking about Document Report ID is RP01(Report). You Mentioned as CH02 and One more thing i didn't have SMTP Server.

Thanks

Sakthivel.S

Not applicable
Author

Option 1 Since the objects will be from Sheets , Save the 4 charts separately and create the html tags and use the above code to send the htmlbody.

Option 2  nprinting  and export the report as html and attach the html in the mail.

Not applicable
Author

Dear Uday,

               But i have Outlook Application not SMTP Server. So My Format to send mail is givent below.

Sub SendMail

Set myApp = CreateObject ("Outlook.Application")

Set myMessage = myApp.CreateItem(olMailItem)

myMessage.BodyFormat = 2 'Outlook.OlBodyFormat.olFormatRichText

'Supplier = ActiveDocument.Variables("SelectedSupplier").GetContent.String

myMessage.Subject = ActiveDocument.Variables("vSubject").GetContent.String  ''"DSC Engineer Productivity Achievement and Penalty %age" 'Supplier & " / Maksukehotus"

'call GetPossibleValues ("E-mail 1","strTo",",")

strTo = ActiveDocument.Variables("ToEmails").GetContent.String

myMessage.To = strTo

StrCc = ActiveDocument.Variables("vCCEmail").GetContent.String

myMessage.Cc = StrCc

Set myInspector = myMessage.GetInspector 'this inserts signature to e-mail

Set myDoc = myInspector.WordEditor

Set var26 = ActiveDocument.Variables("vFilePath")

myMessage.Attachments.Add var26.GetContent.String

ActiveDocument.GetSheetObject("TX150").CopyTextToClipboard

myText = ActiveDocument.GetSheetObject("TX150").GetText 'this is needed to calculate the lenght of the iserted text to put the next object after it

myDoc.Range(0,0).Paste 'This pastes at the begining of the message body

ActiveDocument.GetSheetObject("RP01"),ExportBitmapToFile

myDoc.Range(len(myText),len(myText)).Paste 'Pastes after the previous text 'myDoc.Range(10,10).Paste

' myDoc.Range(myDoc.Characters.Count-1, myDoc.Characters.Count).Paste 'Pastes at the end of the message body

' myMessage.GetInspector.WordEditor.Range.Paste 'Replaces the entire message body with clipboard content

' myInspector.WordEditor.Content.InsertAfter chr(13) 'inserts an empty string at the end of the message body content

myMessage.Display

myMessage.Send

Set myMessage = Nothing

Set myApp = Nothing

Set myInspector = Nothing

Set myDoc = Nothing

'Finally:

'OlSecurityManager.DisableOOMWarnings = False

End Sub

.

Please Help for this. It is very helpful to me...

Not applicable
Author

Try adding this line in your macro.


.HTMLBody =   "<img src=""D:\Chart.jpg""> "


This will get appended to your .TextBody.


I don't have Outlook configured here , Did't test this code. Check and post your results.

imrencimen
Contributor III
Contributor III

ıf we want to show more than one jpg how we write


.HTMLBody = ?