Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
khasimvali85
Creator II
Creator 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

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

Anonymous
Not applicable

Hi try the attached Qv application


Regards

Harsha

khasimvali85
Creator II
Creator II
Author

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.