Downloading Outlook Attachments, via Access

Downloading Outlook Attachments, via Access

Post by SmVmZ » Fri, 21 Jan 2005 05:29:01


I am pretty proficient working with Access VBA but the following I have no
idea how to do, & I would think this is possible.

I would like to know if an Email is recieved & it has attachments to
programtically have the attachments downloaded via Access.

Can this be done through Access ? If so what would be the code to do so ?
I beleive u would have to use the Outlook Object Model but I don't know it,
so the code I would need to have in Access.

Any help would be greatly appreciated.

Thank you,

Downloading Outlook Attachments, via Access

Post by Sue Mosher » Fri, 21 Jan 2005 05:56:36

I don't know what you have in mind as far as downloading goes, but these
samples show a couple of different ways to save attachments: #StripAttachments

Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers


Downloading Outlook Attachments, via Access

Post by Jim Vierra » Sun, 23 Jan 2005 01:51:10

Sue, Jeff

I think I know what you are looking for Jeff.

Sues code contains the components. If youhave looked at a message in Access
then you know that thereis a field "HasAttachments" which is set to True(-1)
when a meesage has one or more attachments. THe task is to use this to
retrieve the message attachments from that particular message and associate
those attachments with the message. To do this you need to use the Outlook
object or CDO to search for the message and retrieve it's attachments.

Message attachments can be retrieved to the files system or inserted into a
field(s) in Access and opened with automation from an Access Forms control.
This is a very good way to create a very customizable archive viewer for
mail messages that is not limited by the Outlook security restrictions.
Forms and programming are best in Access and it can be very easily uploaded
to SQLServer or even work directly to tables in SQLServer if you use an
Access Project..

I suggest using the Outlook object to retrieve the attachments as it is
available on any system with Outlook and CDO may not be installed.

In order to view html, rtf or wordmail message bobies you will have to
choose the appropriate control in Access at display time.

Depending on what you are trying to accomplish, it might be easier to leave
the mail and attachments in Outlook and automate the process from Outlook
with VBA or use Access, assuming you need a database, to extract the items
from Outlook and only choose the pieces you need. you canb then automate
Outlook from inside of Access to display the find and dsiplay the messages
of interest.

Jim Vierra 661815