Excel reading user defined fields in Outlook

R

Richard Naish

Hi,

I cannot seem to be able to access/dispay the content of a user defined
field on an Outlook contact form from within Excel VBA.

Any thoughts very much appreciated! Here is the code:

Sub Open_Outlook()
Dim MyProperty As Object
Dim MyFolder2 As Outlook.MAPIFolder
' Creates path to Outlook and to the Landlords Properties folder

Set ol = New Outlook.Application
Set olns = ol.GetNamespace("MAPI")
Set MyFolder1 = olns.GetDefaultFolder(olFolderContacts)
Set MyFolder2 = MyFolder1.Folders("Properties")
Set MyProperties = MyFolder2.Items
Set MyProperty = MyProperties.Find("[FullName] = ""D101""")
If MyProperty Is Nothing Then ' Find failed
MsgBox "Property Reference not found"
Else
MsgBox MyProperty.FullName
MsgBox MyProperty.UserProperties("LLsurname") ' This is the problem!!
End If
End Sub
 
K

keepitcool

You can download my addin Outlook2Excel
from http://members.chello.nl/keepitcool/download.html


It's unprotected so you can review the code.
Heck you might even like it and use it :)

Note that you should swap the interface language by clicking
the "empty" button on the taskbar!


Be aware that outlook 9 and 10 are different with respect to the
userproperties. (Review Object Explorer/and or Help)


keepITcool

< email : keepitcool chello nl (with @ and .) >
< homepage: http://members.chello.nl/keepitcool >
 

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