Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
khasimvali85
Contributor II

Macro Script

Hi Community,

          My Macro Script were stops here myMessage.BodyFormet=2  is there any error?

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 = "Pending Call status Analysis" 'Supplier & " / Maksukehotus"

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

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

myMessage.To = strTo

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("TX3983").CopyTextToClipboard

myText = ActiveDocument.GetSheetObject("TX3983").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("CH906").CopyTableToClipboard true

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

3 Replies
Not applicable

Re: Macro Script

I used your macro and changed Requested Module Security to "System Access" and Current Local Security to "Allow System Access", it is working fine ...

sriharsha96
Contributor II

Re: Macro Script

Hi try the attached Qv application


Regards

Harsha

khasimvali85
Contributor II

Re: Macro Script

Hi Nagaraj,

                 Thanks for reply

already I have changed System Access and Allow System Access but not run in my application,

the macro stops at myMessage.BodyFormat = 2

Regards,

khasim.

Community Browser