|OLKeeper reliably prevents users from closing their Outlook window and thus possibly missing reminders or e-mails.
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
Path = "d:\"
Path = Path & Format(Date, "yyyy-mm-dd") & "\"
On Error Resume Next
On Error GoTo 0
Set coll = New VBA.Collection
If TypeOf Application.ActiveWindow Is Outlook.Inspector Then
Set Sel = Application.ActiveExplorer.Selection
For i = 1 To Sel.Count
For Each obj In coll
For Each Att In obj.Attachments
Att.SaveAsFile Path & Att.FileName
Shell "Explorer.exe /n, /e, " & Path, vbNormalFocus