粘贴在邮件正文中的单词,包括格式在内

问题描述 投票:0回答:1

我正在处理一个邮件合并宏,但是我正在尝试从我的Word文档中复制文本,包括邮件正文中的格式,很不幸,它在那里不接受range.paste函数。期待任何建议。

    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
    oRange.Copy

*
*
*
           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 

vba outlook ms-word paste
1个回答
0
投票
.HTMLBody = oRange.FormattedText  & olOldBody  
© www.soinside.com 2019 - 2024. All rights reserved.