|
Category-Manager
|
With Category-Manager you can group your Outlook categories, share them with other users, filter a folder by category, automatically categorize new emails, and more. You can use the Addin even for IMAP. |
This example saves all attachments of the selected items to the harddisk. The path assigned to the Path variable must yet exist. The macro automatically creates a subfolder in that directory named with the current date. Eventually the Windows file explorer will be opened with that new directory.
Public Sub SaveAttachments2()
Dim coll As VBA.Collection
Dim obj As Object
Dim Att As Outlook.Attachment
Dim Sel As Outlook.Selection
Dim Path$
Dim i&
Path = "d:\"
Path = Path & Format(Date, "yyyy-mm-dd") & "\"
On Error Resume Next
MkDir Path
On Error GoTo 0
Set coll = New VBA.Collection
If TypeOf Application.ActiveWindow Is Outlook.Inspector Then
coll.Add Application.ActiveInspector.CurrentItem
Else
Set Sel = Application.ActiveExplorer.Selection
For i = 1 To Sel.Count
coll.Add Sel(i)
Next
End If
For Each obj In coll
For Each Att In obj.Attachments
Att.SaveAsFile Path & Att.FileName
Next
Next
Shell "Explorer.exe /n, /e, " & Path, vbNormalFocus
End Sub