The following code was suggested by fumei who assisted greatly.But there is a slight hitch.
pleaHi Gerry,
I have adapted your code slightly(you will notice where) but it comes uo with an error type mismatch at the line, marked****.
Any ideas why?
Thanks again for helping
Piet
The code:
Dim olApp As Outlook.Application
Dim objNameSpace As NameSpace
Dim objInbox As MAPIFolder
Dim objMail As MailItem
Dim objAttach As Attachment
Set olApp = CreateObject("Outlook.Application")
Set objNameSpace = olApp.GetNamespace("MAPI")
Set objInbox = objNameSpace.GetDefaultFolder(olFolderInbox)
For Each objMail In objInbox.Items()
If objMail.UnRead = True Then
Set objAttach = objMail.Attachments ****
objAttach.SaveAsFile "C:\Rossair3\" & _
objAttach.item(1).DisplayName
End If
Next
Set objInbox = Nothing
Set objNameSpace = Nothing
Set olApp = Nothingse help
pleaHi Gerry,
I have adapted your code slightly(you will notice where) but it comes uo with an error type mismatch at the line, marked****.
Any ideas why?
Thanks again for helping
Piet
The code:
Dim olApp As Outlook.Application
Dim objNameSpace As NameSpace
Dim objInbox As MAPIFolder
Dim objMail As MailItem
Dim objAttach As Attachment
Set olApp = CreateObject("Outlook.Application")
Set objNameSpace = olApp.GetNamespace("MAPI")
Set objInbox = objNameSpace.GetDefaultFolder(olFolderInbox)
For Each objMail In objInbox.Items()
If objMail.UnRead = True Then
Set objAttach = objMail.Attachments ****
objAttach.SaveAsFile "C:\Rossair3\" & _
objAttach.item(1).DisplayName
End If
Next
Set objInbox = Nothing
Set objNameSpace = Nothing
Set olApp = Nothingse help