S
Simon
Hi
I have a customized form in my Outlook contacts with an
additional page where I added a ComboBox with the
following code:
Sub Item_Open
' Set the NameSpace object
Set objOLNS = Application.GetNameSpace("MAPI")
' Set the Contacts folder, which is in the MAPI
NameSpace
Set objContactFolder = objOLNS.Folders("Public
Folders"). _
Folders("All Public Folders"). _
Folders("Contacts"). _
Folders("Administration")
' Set the collection of all Contact items
Set objAllContacts = objContactFolder.Items
' Set the object referring to the form page the
combo box is on
Set objFormTab =
Item.GetInspector.ModifiedFormPages("MFO - Related
Contacts")
' Set the object referring to the combo box
Set objCombo = objFormTab.Controls("Contact1")
' Loop through all of the contacts
For Each Contact in objAllContacts
' Add the current contact's full name to the
combo box
'objCombo.AddItem Contact.FileAs
objCombo.AddItem Contact.FullName
Next
End Sub
This code adds all contacts in my Public Folder (certain
subfolder - see above) into the ComboBox. This works fine
and I can select any contact I want to.
Now, I would like to add a CommandButton to this form
which has the following function:
If you push the button of the previous selected contact
in the ComboBox the contact is displayed in a new contact
form (Basically the same functionality as if you open a
contact in you contact when you double click on it and
the contact is shown in a form).
I couldn't figure it out how I could code this
functionality. Could you please help me?
Thank you very much in advance.
Regards
Simon
I have a customized form in my Outlook contacts with an
additional page where I added a ComboBox with the
following code:
Sub Item_Open
' Set the NameSpace object
Set objOLNS = Application.GetNameSpace("MAPI")
' Set the Contacts folder, which is in the MAPI
NameSpace
Set objContactFolder = objOLNS.Folders("Public
Folders"). _
Folders("All Public Folders"). _
Folders("Contacts"). _
Folders("Administration")
' Set the collection of all Contact items
Set objAllContacts = objContactFolder.Items
' Set the object referring to the form page the
combo box is on
Set objFormTab =
Item.GetInspector.ModifiedFormPages("MFO - Related
Contacts")
' Set the object referring to the combo box
Set objCombo = objFormTab.Controls("Contact1")
' Loop through all of the contacts
For Each Contact in objAllContacts
' Add the current contact's full name to the
combo box
'objCombo.AddItem Contact.FileAs
objCombo.AddItem Contact.FullName
Next
End Sub
This code adds all contacts in my Public Folder (certain
subfolder - see above) into the ComboBox. This works fine
and I can select any contact I want to.
Now, I would like to add a CommandButton to this form
which has the following function:
If you push the button of the previous selected contact
in the ComboBox the contact is displayed in a new contact
form (Basically the same functionality as if you open a
contact in you contact when you double click on it and
the contact is shown in a form).
I couldn't figure it out how I could code this
functionality. Could you please help me?
Thank you very much in advance.
Regards
Simon