JJ said:
Hi,
Has anyone got a sample macro to do this?
Here we are (extracted from my macro for saving attachments to disk and
removing them from the message):
Sub Attachments()
Dim myOlApp As Outlook.Application
Dim myInspector As Outlook.Inspector
Dim myItem As Outlook.MailItem
Dim myAttachments As Outlook.Attachments
'
Set myOlApp = CreateObject("Outlook.Application")
Set myInspector = myOlApp.ActiveInspector
If Not TypeName(myInspector) = "Nothing" Then
If TypeName(myInspector.CurrentItem) = "MailItem" Then
Set myItem = myInspector.CurrentItem
Set myAttachments = myItem.Attachments
If myAttachments.Count > 0 Then
For i = myAttachments.Count To 1 Step -1
MsgBox "Name of attachment is " & _
myAttachments.Item(i).DisplayName
Next i
End If
Else
MsgBox "The current selection is no message."
End If
End If
'free variables
Set myOlApp = Nothing
Set myInspector = Nothing
Set myItem = Nothing
Set myAttachments = Nothing
End Sub