Is there a way in VBA that would open up the most recent
e-mail from a particular sender in outlook. The following code works fine but it only works if I have the e-mail open (Set myItem = myOlApp.ActiveInspector.CurrentItem).
' ##########
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.ActiveInspector.CurrentItem
Set myAttachments = myItem.Attachments
myAttachments.Item(1).SaveAsFile "C:\My Documents\" & _
myAttachments.Item(1).DisplayName
' ################
I like to enhance this code such that the code opens up the outlook application, looks for the most recent e-mail from the particular sender, eeport the attachment from the e-mail to my personal folder.
I have been struggling with this quite a bit. Any ideas/help will be highly appreciated. Thanks
e-mail from a particular sender in outlook. The following code works fine but it only works if I have the e-mail open (Set myItem = myOlApp.ActiveInspector.CurrentItem).
' ##########
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.ActiveInspector.CurrentItem
Set myAttachments = myItem.Attachments
myAttachments.Item(1).SaveAsFile "C:\My Documents\" & _
myAttachments.Item(1).DisplayName
' ################
I like to enhance this code such that the code opens up the outlook application, looks for the most recent e-mail from the particular sender, eeport the attachment from the e-mail to my personal folder.
I have been struggling with this quite a bit. Any ideas/help will be highly appreciated. Thanks