|
在outlook 编辑页面写了以下代码:出现这个错误提醒~大家帮忙看看哪里错了~谢谢啦,新手学习中
Sub testApp4()
Dim olNameSpace As NameSpace
Dim olFolder As Folder
Dim myMail As MailItem
Dim i As Integer
Dim strSavePath As String
Set olNameSpace = Application.GetNamespace("MAPI") '获取命名空间
Set olFolder = olNameSpace.GetDefaultFolder(olFolderInbox).Folders("Info") '获取Inbox对象
Set myMail = olFolder.Items("圣诞节礼物交换活动")
strSavePath = "C:\myTestFiles"
Set myPathToFind = CreateObject("Scripting.FileSystemObject")
If Not myPathToFind.folderExists(strSavePath) Then
myPathToFind.createfolder (strSavePath)
End If
For i = 1 To myMail.Attachments.Count
myMail.Attachments.Item(i).SaveAsFile (strSavePath & "\" & myMail.Attachments.Item(i).FileName)
Next
MsgBox "OK"
End Sub
|
|