Extracting Outlook attachments automatically

G

Giovanni7

All,
I've got Outlook 2003 on a Windows XP/SP2 system.

I get a weekly email with an attachment that I want to automatically save (i.e. ,without user intervention) to a specified folder where I can process it with a batch file that is initiated by the same email (using Outlook's Rules and Alerts).

That is, I want a Rule that initiates a DOS batch file. The first command in the batch file should save the attached pdf file from the email to a specified folder. Subsequent commands in the batch file rename it and upload it to a webserver.

Outlook Rules and Alerts doesn't appear to let me process attachments (other than using attachments as a criterion for flagging the incoming message).

I didn't like the add-in program Attachment Master as it looks as if it's designed to process all attachments in a given Outlook folder; I want to process specific attachments to specific emails.

Is it possible to consistently find the folder where attachments from Outlook are stored? If every week the attachments get stored to the same folder, I just need to know where they are to process them...

Thanks very much for your help or suggestions of other forums to try if this is not the most appropriate one...
 
J

John Blessing

I suggest you write some VBA code in the application_newmail event

If you can write batch files, you are probably up to the job, just do some
googling on Outlook Script or Outlook VBA.

--
John Blessing

http://www.LbeHelpdesk.com - Help Desk software priced to suit all
businesses
http://www.room-booking-software.com - Schedule rooms & equipment bookings
for your meeting/class over the web.
http://www.lbetoolbox.com - Remove Duplicates from MS Outlook, find/replace,
send newsletters
 
G

Giovanni7

Thanks to John for suggesting writing an Outlook VBA macro that extracts attachments and saves them.
My macro works fine; now I want the macro to execute without user intervention, specifically by invoking the macro as the first command in a batch file that is inititated by an Outlook Rule upon receipt of an email.

Would the Outlook macro have to be saved as a .dll executable file in order to be run from a batch file?

In summary, what I'm trying to do:
I first need the email attachment to be copied to a folder.
(This is presently accomplished with the Outlook VBA macro; I'd like it to run without user intervention, ideally as part of an Outlook Rule).
Second, I rename the attachment and other files (via the batch file command initiated by receipt of an email).
Third, I updload the renamed files to my webserver (via the batch file command initiated by receipt of an email).

Thanks again for your help!

I'm using
Outlook 2003
Windows XP / SP2
 
M

Michael Bauer [MVP - Outlook]

This could work: Create a Run-a-Script rule, which can call your macro after
receiving an e-mail. From the VBA code you can start a batch file by calling
the ShellExecute function. Copy this declaration to the top of
"ThisOutlookSession":

Private Declare Function ShellExecute Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long


and call it from the script with:

ShellExecute 0, "open", "c:\test.bat", "", "", 1


--
Best regards
Michael Bauer - MVP Outlook
Synchronize Outlook Categories:
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>

Am Tue, 15 Jan 2008 15:08:11 -0800 schrieb Giovanni7:
Thanks to John for suggesting writing an Outlook VBA macro that extracts attachments and saves them.
My macro works fine; now I want the macro to execute without user
intervention, specifically by invoking the macro as the first command in a
batch file that is inititated by an Outlook Rule upon receipt of an email.
Would the Outlook macro have to be saved as a .dll executable file in
order to be run from a batch file?
In summary, what I'm trying to do:
I first need the email attachment to be copied to a folder.
(This is presently accomplished with the Outlook VBA macro; I'd like it to
run without user intervention, ideally as part of an Outlook Rule).
Second, I rename the attachment and other files (via the batch file
command initiated by receipt of an email).
Third, I updload the renamed files to my webserver (via the batch file
command initiated by receipt of an email).
 
J

John Blessing

command in a batch file that is inititated by an Outlook Rule upon receipt
of an email.

As previously stated, all you need is code in the application_newmail event
to save the attachment

Tools, Macros, Visual Basic Editor

Left top - choose ThisOutlookSession under Microsoft Visual Objects, then in
the lefthand dropdown of the main window, select Application, then in the
right-hand dropdown select Newmail.

--
John Blessing

http://www.LbeHelpdesk.com - Help Desk software priced to suit all
businesses
http://www.room-booking-software.com - Schedule rooms & equipment bookings
for your meeting/class over the web.
http://www.lbetoolbox.com - Remove Duplicates from MS Outlook, find/replace,
send newsletters
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top