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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro

Hi Guys,

Can anyone explain me what this below macro does?

Sub SendMail

Set myApp = CreateObject ("Outlook.Application")

Set myMessage = myApp.CreateItem(olMailItem)

myMessage.BodyFormat = 3 'Outlook.OlBodyFormat.olFormatRichText

'Agency = ActiveDocument.Variables("v").GetContent.String

myMessage.Subject = "Request to change agency segment"

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

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

myMessage.To = strTo

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

Set myDoc = myInspector.WordEditor

ActiveDocument.GetSheetObject("TX149").CopyTextToClipboard

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

'myText = myText & ActiveDocument.GetSheetObject("TX146").GetText

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

'ActiveDocument.GetSheetObject("TX146").CopyTextToClipboard

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

ActiveDocument.GetSheetObject("LA36").CopyTableToClipboard true

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

' 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

Set myMessage = Nothing

Set myApp = Nothing

Set myInspector = Nothing

Set myDoc = Nothing

end sub

0 Replies