2016-09-22

如何在Outlook中带附件回复邮件


最近公司邮箱由Lotus换成了Outlook,回复邮件时发现不能像Lotus那样自带附件;Outlook转发邮件时是带附件的,不知道为什么回复时都自动去掉了?那有什么办法解决这个问题呢,拷贝粘贴当然可行,不过有些麻烦不在讨论之列,具体方案如下:

1. 启动Outlook,文件-》选项-》信任中心-》信任中心设置-》宏设置-》启动所有宏,确定;

2. Outlook下按AltF11打开VB,添加以下代码至Project1-》Microsoft Outlook Objects-》ThisOutlookSession(双击);保存关闭:

Sub RunReplyWithAttachments()

Dim oReply As Outlook.MailItem

Dim oItem As Object

Set oItem = GetCurrentItem()

If Not oItem Is Nothing Then

Set oReply = oItem.Reply

CopyAttachments oItem, oReply

oReply.Display

End If

Set oReply = Nothing

Set oItem = Nothing

End Sub

Sub RunReplyAllWithAttachments()

Dim oReply As Outlook.MailItem

Dim oItem As Object

Set oItem = GetCurrentItem()

If Not oItem Is Nothing Then

Set oReply = oItem.ReplyAll

CopyAttachments oItem, oReply

oReply.Display

End If

Set oReply = Nothing

Set oItem = Nothing

End Sub

Function GetCurrentItem() As Object

On Error Resume Next

Select Case TypeName(Application.ActiveWindow)

Case "Explorer"

Set GetCurrentItem = Application.ActiveExplorer.Selection.Item(1)

Case "Inspector"

Set GetCurrentItem = Application.ActiveInspector.CurrentItem

End Select

End Function

Sub CopyAttachments(oSourceItem, oTargetItem)

Set oFso = CreateObject("Scripting.FileSystemObject")

Set fldTemp = oFso.GetSpecialFolder(2) 'Temporary Folder

sPath = fldTemp.Path & "\"

For Each oAtt In oSourceItem.Attachments

sFile = sPath & oAtt.FileName

oAtt.SaveAsFile sFile

oTargetItem.Attachments.Add sFile, , , oAtt.DisplayName

oFso.DeleteFile sFile

Next

Set fldTemp = Nothing

Set oFso = Nothing

End Sub

3. Outlook下打开文件-》选项-》定制用户界面;左侧命令选择列表中选择宏;相应的两个命令(转发和全部转发)添加到右侧的主工具栏,选择主页(邮件),下面建立一个新的分组,对应的名字和图标可自行设置,确定,主界面就有了相应的图标



简单地说,Outlook中带附件回复邮件一共三步,启动宏;添加宏;添加快捷菜单。