本文介绍了邮件正文中的单词粘贴范围,包括格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在处理一个邮件合并宏,但我正试图从我的Word文档中复制文本,包括邮件正文中的格式,很不幸,它在那里不接受range.paste函数. 期待任何建议.
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 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推荐答案
我现在解决了将html代码添加到我的Word文档中的问题,并在不复制粘贴的情况下包含了全部内容.效果很好.
I now worked around the problem with adding html code to my word document and included the whole content without copy-paste. This worked out pretty good.
.HTMLBody = oDoc.Content & olOldBody更多推荐
邮件正文中的单词粘贴范围,包括格式
发布评论