Microsoft Access Office VB VBA Help and Examples
           

Accessing user defined fields in an Outlook message

If you have a reference to an outlook mailitem and wish to access the user defined fields within that message then all you need to do is use

Dim olmail as Outlook.Mailitem
Set olmail = 'whatever method you use to get the mailitem in question
Msgbox olmail.userproperties.item("fieldname")

This method will allow you get all the values out of a custom form so you could strip them into a database.

If you do not know what fields are in the form then the following bit of code allows you to loop through all user defined fields

Dim olmail As Outlook.MailItem
Dim fld As Outlook.UserProperty
For Each fld In olmail.UserProperties
       msgbox "Field Name : " & fld.name & vbcrlf & "Field Value : " & fld.value
Next
 
HOME   SEARCH SITE   PRIVACY POLICY   CONTACT
The code and application content of this site is copyright of Smiley I.T. and as such reproduction in any form which is for commercial use requires the permission of the Webmaster. Any use of this code for non-commercial use only requires a link or comment back to the original page you took the code from.