[dba-Tech] Cycling through Outlook Items using VBA

Susan Harkins ssharkins at setel.com
Fri Jul 13 08:28:19 CDT 2007


I asked this over on Access-d, but didn't see a response. Sorry for those of
you that are seeing a repeat. 

I'm trying to export mail items to an Access data. A wizard takes care of
this nicely, if you go the manual route. The wizard will create a database
if it doesn't exist and will export all the fields without specifically
mapping them to an Access table -- it works great. 

Using VBA, the only way I've found to do the same is to cycle through all
the mail fields and using a Recordset object add them to an existing
database with the appropriate table fields. 

Now, I expected to find some easy-to-implement export method in the form,
but I haven't. My code lets the user select a folder and checks for the
folder "type" using a For loop that counts items in the folder: 

For I = CurrentFolder.Items.Count To 1 Step -1

but then I have to hardcode all the mail fields -- was hoping to avoid all
that. 

Is there an export function? I can't find it in Outlook's VBA Help. Also, I
really thought a For Each would be better, but can't get the objects right.

Susan H. 




More information about the dba-Tech mailing list