文章目录
  1. 1. Outlook reply with attachment

Outlook reply with attachment

从Notes换到Outlook总有人会问,这个在Outlook里面有没有,那个在Outlook里面有没有,说实话,这两个系统都蛮强大的,基本所有的功能都能用VBA和Agent来模拟出来。
问得最多的一个问题是Reply all with attachment为什么在Outlook里面找不到了。
说实话,我觉得微软的意思是回复的话,你要回的那些人都看到过附件了,就不要再发一次了,不过习惯使然,还是有人需要的,研究了一下,最方便的办法还是写VBA

Sub ReplyWithAttachments()
Dim rpl As Outlook.MailItem
Dim itm As Object
Set itm = GetCurrentItem()
If Not itm Is Nothing Then
Set rpl = itm.Reply
CopyAttachments itm, rpl
rpl.Display
End If
Set rpl = Nothing
Set itm = Nothing
End Sub

Function GetCurrentItem() As Object
Dim objApp As Outlook.Application
Set objApp = Application
On Error Resume Next
Select Case TypeName(objApp.ActiveWindow)
Case “Explorer”
Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1)
Case “Inspector”
Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
End Select
Set objApp = Nothing
End Function

Sub CopyAttachments(objSourceItem, objTargetItem)
Set fso = CreateObject(“Scripting.FileSystemObject”)
Set fldTemp = fso.GetSpecialFolder(2)
strPath = fldTemp.Path & “\”
For Each objAtt In objSourceItem.Attachments
strFile = strPath & objAtt.FileName
objAtt.SaveAsFile strFile
objTargetItem.Attachments.Add strFile, , , objAtt.DisplayName
fso.DeleteFile strFile
Next
Set fldTemp = Nothing
Set fso = Nothing
End Sub

打开VBA,把这段复制进去,然后调用宏里面的ReplyAllwithattachments就可以了,还可以自定义工具栏给这个宏分配一个按钮来用。