(Solved) – Paste rang from word in mailbody including the format


I’m working on a mail merge macro and I’m trying to copy the text from my word document including the format in the mail body unfortunately it doesn’t accept the range.paste function there.
Looking forward to any advice.

    Set oWord = CreateObject("Word.Application")

    oWord.Documents.Open FileName:="*Flightticket.docx", ReadOnly:=True
    Set oDoc = oWord.ActiveDocument
    Set oRange = ActiveDocument.Range(Start:=0)
    oWord.Visible = False

           With oMail
               .To = oContact.Email1Address
               .Subject = Left(oDoc.Name, Len(oDoc.Name) - 5) & " " & mText
               .GetInspector.Activate 'Signatur
               olOldBody = .HTMLBody
               'The content of the document is used as the body for the email
                .HTMLBody = oRange.Paste  & olOldBody               'Here is the error
             End With 

Leave a Reply

Your email address will not be published. Required fields are marked *