用户需要在电子邮件正文中发送 Word 文档(而不是作为附件),并在所有电子邮件通信中包含签名。
用户目前正在使用Send to Mail Recipient
,它将文档插入电子邮件正文中,但他们无法自动添加签名,必须在每封电子邮件中手动添加。据我了解,这是因为嵌入在 Word 中的邮件与 Outlook 完整版不同。
Word 中的常规E-Mail
命令将会显示一封带有签名的新电子邮件,但该文档是附件而不是电子邮件正文。
有没有办法让 Word 在电子邮件正文中发送其内容,并自动插入用户的签名?
我正在寻找一种可以适用于 Office 2007 和 2010 并且宏也可以使用的解决方案。
答案1
我在 HowTo-Outlook.com 上找到了一个可以启用此功能的 Word 宏,位于“将 Word 文档作为电子邮件发送“:
Sub SendDocAsMail()
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
On Error Resume Next
'Start Outlook if it isn't running
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
End If
'Create a new message
Set oItem = oOutlookApp.CreateItem(olMailItem)
'Allow the user to write a short intro and put it at the top of the body
Dim msgIntro As String
msgIntro = InputBox("Write a short intro to put above your default " & _
"signature and current document." & vbCrLf & vbCrLf & _
"Press Cancel to create the mail without intro and " & _
"signature.", "Intro")
'Copy the open document
Selection.WholeStory
Selection.Copy
Selection.End = True
'Set the WordEditor
Dim objInsp As Outlook.Inspector
Dim wdEditor As Word.Document
Set objInsp = oItem.GetInspector
Set wdEditor = objInsp.WordEditor
'Write the intro if specified
Dim i As Integer
If msgIntro = IsNothing Then
i = 1
'Comment the next line to leave your default signature below the document
wdEditor.Content.Delete
Else
'Write the intro above the signature
wdEditor.Characters(1).InsertBefore (msgIntro)
i = wdEditor.Characters.Count
wdEditor.Characters(i).InlineShapes.AddHorizontalLineStandard
wdEditor.Characters(i + 1).InsertParagraph
i = i + 2
End If
'Place the current document under the intro and signature
wdEditor.Characters(i).PasteAndFormat (wdFormatOriginalFormatting)
'Display the message
oItem.Display
'Clean up
Set oItem = Nothing
Set oOutlookApp = Nothing
Set objInsp = Nothing
Set wdEditor = Nothing
End Sub
如果您需要逐步帮助将宏放入 Word,实际(上面)链接有该信息,包括图片。