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
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