JAhODJFG.zip
(32.49 KB, 下载次数: 7)
附件是一个包含有两个邮件附件的文件 以下的程序也能在单独打开的邮件窗口下执行,但附件并没有保存到inbox\test 中,但也不报错,何解? Sub T2()
Dim myOlApp As New Outlook.Application Dim myNamespace As Outlook.NameSpace Dim myInbox As Outlook.MAPIFolder Dim myDestFolder As Outlook.MAPIFolder Set myNamespace = myOlApp.GetNamespace("MAPI") Set myInbox = myNamespace.GetDefaultFolder(olFolderInbox) Set myTEST = myInbox.Folders("TEST")
Dim mFileName, mSubject As String Dim iPos As Integer Dim i As Integer Dim C As MailItem Set C = ActiveInspector.CurrentItem
If TypeName(C) <> "MailItem" Then MsgBox "当前活动窗口不是一封邮件" ElseIf C.Attachments.Count > 0 Then For i = 1 To C.Attachments.Count T1 = C.Attachments.Item(i).FileName 'MsgBox Mid(T1, Len(T1) - 2, 3) If Mid(T1, Len(T1) - 2, 3) = "msg" Then C.Attachments.Item(i).SaveAsFile (myTEST) '执行并不报错,但不晓得保存到哪个地方去了? Else MsgBox T1 & " 附件不是一封邮件将被忽略,点确认进入下一个处理" End If Next Else MsgBox "当前邮件没有附件" End If
End Sub |