Code to move attachment and open excel workbook

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a bit experience in excel vba but none of outlook. Now i am looking
for a code: to move attachment to a specific folder and open an excel
workbook. Can any expert help?
 
Am Mon, 10 Oct 2005 19:31:02 -0700 schrieb Angus:

First you might want to ensure that the folder exists. This can be done
easily with the "Microsoft Scripting Runtime". Set a reference to the
library in your project and use its FileSystemObject. Then save the
attachment with its SaveAsFile method.

If you really want to "move" the attachment then you can it delete now from
the e-mail with Attachment.Delete.

For opening an Excel Workbook add a reference to Excel in your project and
use the Workbooks.Open function. A sample is available in the Excel VBA
help.
 
Thanks for your reply... but I am really new for outlook codes, how to save
the attachment with its SaveAsFile method?
 
Am Tue, 11 Oct 2005 02:02:03 -0700 schrieb Angus:

This saves all attachments of an opened e-mail:

Dim oAtt as Outlook.Attachment
Dim oMail as Outlook.MailItem
If TypeOf Application.ActiveInspector.CurrentItem is Outlook.MailItem Then
set oMail=Application.ActiveInspector.CurrentItem
For Each oAtt to oMail.Attachments
oAtt.SaveAsFile "YourPathHere"
Next
Endif
 
Got it. Thanks.

Michael Bauer said:
Am Tue, 11 Oct 2005 02:02:03 -0700 schrieb Angus:

This saves all attachments of an opened e-mail:

Dim oAtt as Outlook.Attachment
Dim oMail as Outlook.MailItem
If TypeOf Application.ActiveInspector.CurrentItem is Outlook.MailItem Then
set oMail=Application.ActiveInspector.CurrentItem
For Each oAtt to oMail.Attachments
oAtt.SaveAsFile "YourPathHere"
Next
Endif
 
Back
Top