邮件正文中的单词粘贴范围,包括格式

编程入门 行业动态 更新时间:2024-10-21 03:47:19
本文介绍了邮件正文中的单词粘贴范围,包括格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在处理一个邮件合并宏,但我正试图从我的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

更多推荐

邮件正文中的单词粘贴范围,包括格式

本文发布于:2023-10-12 23:57:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1486236.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文中   单词   邮件   格式

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!