Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Access as an automation server for Outlook, can you save attach

Status
Not open for further replies.

SBendBuckeye

Programmer
May 22, 2002
2,166
US
I have a client who receives an email with an attached Excel spreadsheet. I have seen MAPI code that runs against new incoming messages, but I have never had to do it and have some questions:

A. How do you hook the Access code into Outlook so it runs whenever a new message is received?

B. Can I detect an attachment on an incoming eMail and if so can I save it to a folder outside of Outlook?

Thanks in advance for any help you can give me!

Have a great day!

 
Your asking a pretty broad question. Let me give you a couple of broad answers to start.

B. Can I detect an attachment on an incoming eMail and if so can I save it to a folder outside of Outlook?

You have to set up a reference to the Outlook object model in your Access project. Using the object model, you can do pretty much whatever you want with the user's Outlook folders such as the Inbox. There are all kinds of books w/code on cds that show how to do this. Best one I used early on was "Power Programming with Access 2000" which has a very easy to grasp chapter and great demo code on Outlook/Access integration.

A. How do you hook the Access code into Outlook so it runs whenever a new message is received?

The only way I can think of off hand is to set up a timer event on a form and leave the Access program minimized on the user's desktop. The timer event would check for the Outlook events you are looking for. However:

You can also code your application directly in Outlook, using Access as an object within your Outlook VBA application. Depending on your application, this may be more efficient. I would only code it in Access if I needed to pop up forms and reports in response to the email events.



 
I believe you need to consider which Office applications would be be used. Outlook contains the events to determine whether an email is received and can EASILY be modified to then store the attachment WHEREEVER you want to have it stored anywhere on your local machine or network. Remember that all Office applications use VBA as their glue.

If you are not really serious about having Access know when that event happens you could invoke Access automation from within Outlook to run a macro and even pass it the full filename. Or you could create an application that monitors a directory and invokes Access automation wheneven a new file is stored in the directory.

Just remember, there are no events in Access to know when the email is received. So the initial discovery is done in Outlook. Become familiar with the object model by opening the Visual Basic Editor in Outlook and trial and error if you don't have some type of Outlook documentation. It's easy to get on the internet.

-------------------------------------
scking@arinc.com
Try to resolve problems independently
Then seek help among peers or experts
But TEST recommended solutions
-------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top