我更改了一些代码,以便将选定的邮件附件添加到我的硬盘中,如下所示:
Public Sub SaveAttachments()
Dim objOL As Outlook.Application
Dim objMsg As Outlook.MailItem 'Object
Dim objAttachments As Outlook.Attachments
Dim objSelection As Outlook.Selection
Dim I As Long
Dim lngCount As Long
Dim strFile As String
Dim strFolderpath As String
Dim strDeletedFiles As String
Dim Counter As Long
strFolderpath = "D:\attachments"
If (Dir$(strFolderpath, vbDirectory) = "") Then
    MsgBox "'" & strFolderpath & "'  not exist"
    MkDir strFolderpath
    MsgBox "'" & strFolderpath & "'  we create it"
Else
    MsgBox "'" & strFolderpath & "'  exist"
End If
    ' Get the path to your My Documents folder
    'strFolderpath = CreateObject("WScript.Shell").SpecialFolders(16)
    strFolderpath = strFolderpath & "\"
    On Error Resume Next
    ' Instantiate an Outlook Application object.
    Set objOL = CreateObject("Outlook.Application")
    ' Get the collection of selected objects.
    Set objSelection = objOL.ActiveExplorer.Selection
' The attachment folder needs to exist
' You can change this to another folder name of your choice
    ' Set the Attachment folder.
    strFolderpath = strFolderpath
    ' Check each selected item for attachments.
    Counter = 1
    For Each objMsg In objSelection
    Set objAttachments = objMsg.Attachments
    lngCount = objAttachments.Count
    If lngCount > 0 Then
    ' Use a count down loop for removing items
    ' from a collection. Otherwise, the loop counter gets
    ' confused and only every other item is removed.
    For I = lngCount To 1 Step -1
    ' Get the file name.
    strFile = objAttachments.Item(I).FileName
    ' Combine with the path to the Temp folder.
    strFile = strFolderpath & Counter & "_" & strFile
    ' Save the attachment as a file.
    objAttachments.Item(I).SaveAsFile strFile
    Counter = Counter + 1
    Next I
    End If
    Next
ExitSub:
Set objAttachments = Nothing
Set objMsg = Nothing
Set objSelection = Nothing
Set objOL = Nothing
    MsgBox "All Selected Attachments Have Been Downloaded ..."
End Sub
我的目标电子邮件使用imap服务...
这个vb代码完美无缺!
但我的问题是,当下载完成后,我们不需要附件文件夹中的文件!
我的收件箱里有450 封UNREAD电子邮件,所有邮件都有附件... 
但我们在附件文件夹中只有200个文件!(由高级代码创建)
我该如何解决这个问题?
似乎这个问题与未读消息和我的ADSL速度有关(但它不应该,我不知道?!)
当你阅读电子邮件时,似乎Outlook用那封电子邮件做了一些事情,所以下次那封电子邮件因为它的缓存而运行得更快。
如何使用高级代码处理未读电子邮件?
或者对这个问题有任何想法吗?  
最后,我非常感谢您的评论,并添加或更正我的代码