3 Replies Latest reply: Dec 18, 2014 1:00 AM by khasimvali shaik RSS

    Macro Script

    khasimvali shaik

      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


      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





      Set myMessage = Nothing

      Set myApp = Nothing

      Set myInspector = Nothing

      Set myDoc = Nothing



      'OlSecurityManager.DisableOOMWarnings = False


      End Sub