E
Edgar Thoemmes
Hi
I have the following code that checks incoming messages
and if they meet certain conditions it should copy them to
a specific folder on my hard drive. When I receive a new
message from the person i have specified in the Sender
Name property I get a message box saying that 'A program
is trying to access an outlook item' so it looks like most
of the code is working but when i go to the folder that i
have specified it hasnt copied it there. Any help would be
much appreciated.
Private Sub objInbox_ItemAdd(ByVal Item As Object)
If Item.Class = olMail And Item.Subject = "Test Att"
Then
If Item.SenderName = "Edgar Thoemmes" Then
If Item.Attachments.Count > 0 Then
Dim objAttachments As Outlook.Attachments
Set objAttachments = Item.Attachments
For Each objAttach In objAttachments
' Does not handle duplicate
filename scenarios
objAttach.SaveAsFile "C:\remit\" &
Item.Subject & ".rtf"
Next
Set objAttachments = Nothing
End If
End If
End If
End Sub
I have the following code that checks incoming messages
and if they meet certain conditions it should copy them to
a specific folder on my hard drive. When I receive a new
message from the person i have specified in the Sender
Name property I get a message box saying that 'A program
is trying to access an outlook item' so it looks like most
of the code is working but when i go to the folder that i
have specified it hasnt copied it there. Any help would be
much appreciated.
Private Sub objInbox_ItemAdd(ByVal Item As Object)
If Item.Class = olMail And Item.Subject = "Test Att"
Then
If Item.SenderName = "Edgar Thoemmes" Then
If Item.Attachments.Count > 0 Then
Dim objAttachments As Outlook.Attachments
Set objAttachments = Item.Attachments
For Each objAttach In objAttachments
' Does not handle duplicate
filename scenarios
objAttach.SaveAsFile "C:\remit\" &
Item.Subject & ".rtf"
Next
Set objAttachments = Nothing
End If
End If
End If
End Sub