E
Ed
Hi
I have the following code which checks a new email message
for attachments and if it finds any saves them to a
specific folder on my hard drive. I need it instead of
saving the file name as the original attachment name to
save as the subject of the email instead. I think i know
how do this but i dont know how to refer to the subject of
the message in code. Does any have any ideas?
Private Sub objInbox_ItemAdd(ByVal Item As Object)
If Item.Class = olMail And Item.Subject = "Test Att"
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\" &
objAttach.FileName
Next
Set objAttachments = Nothing
End If
End If
End Sub
I have the following code which checks a new email message
for attachments and if it finds any saves them to a
specific folder on my hard drive. I need it instead of
saving the file name as the original attachment name to
save as the subject of the email instead. I think i know
how do this but i dont know how to refer to the subject of
the message in code. Does any have any ideas?
Private Sub objInbox_ItemAdd(ByVal Item As Object)
If Item.Class = olMail And Item.Subject = "Test Att"
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\" &
objAttach.FileName
Next
Set objAttachments = Nothing
End If
End If
End Sub