WHich Property is bound to the control

M

Michael Tissington

Given an Inspector object and a Pages collection from GetModifiedPages.

I'm looping through all the controls on a Page.

How can I find out the property that a Control is bound to?

Thanks
 
S

Sue Mosher [MVP-Outlook]

Yes, it's a control property. If you use it, you should get a result. It
won't show up in Intellisense, though, because it's specific to Outlook, not
part of the MSForms 2.0 library.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
S

Sue Mosher [MVP-Outlook]

Should work, although you'll probably have to use a little late binding. I
whipped this code out in Word VBA (no VB on this machine):

Sub EnumControls()
Dim objOL As Outlook.Application
Dim objInsp As Outlook.Inspector
Dim objPage As Object ' msforms.userform and msforms.page won't work
Dim objControl As MSForms.Control
Dim intPages As Integer
Dim i As Integer
On Error Resume Next

Set objOL = CreateObject("Outlook.Application")
Set objInsp = objOL.ActiveInspector
intPages = objInsp.ModifiedFormPages.Count
For i = 1 To intPages
Set objPage = objInsp.ModifiedFormPages(i)
Debug.Print objPage.Name
For Each objControl In objPage.Controls
If objControl.ItemProperty <> "" Then
Debug.Print objControl.Name, objControl.ItemProperty
End If
Next
Next
End Sub

and got these results from a contact form to which I'd added a control on
P.3:

General
FullName Full Name
JobTitle Job Title
Company Company
FileAs File As
Phone1Label Phone 1 Selector
Phone1Button Phone 1 Selector
Phone1 Phone 1 Selected
Phone2Label Phone 2 Selector
Phone2Button Phone 2 Selector
Phone2 Phone 2 Selected
Phone3Label Phone 3 Selector
Phone3Button Phone 3 Selector
Phone3 Phone 3 Selected
Phone4Label Phone 4 Selector
Phone4Button Phone 4 Selector
Phone4 Phone 4 Selected
AddressButton Check Address...
Address Address Selected
AddressSelectorLabel Address Selector
AddressSelectorButton Address Selector
MailingAddressCheckbox Mailing Address Indicator
EmailSelectorLabel E-mail Selector
EmailSelectorButton E-mail Selector
Email E-mail Selected
EmailButton E-mail Selected
WebPage Web Page
Notes Notes
CategoriesButton Categories...
Categories Categories
Private Private
FullNameButton Check Name...
_RecipientControl1 Contacts
ContactsButton Contacts
IMAddress IM Address
EmailDisplayAs E-mail Display As
P.3
_RecipientControl1 Contacts
CommandButton1 Contacts


See what I mean about getting the field names, not the property names?
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

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