VBA access to controlelement in a form

  • Thread starter Thread starter Markus Beck
  • Start date Start date
M

Markus Beck

Hello,
i adapted the form for contact and provided therein a
drop-down control. This drop-down control has given values.
The new Contact-Form is assigned to all contacts. I would
like to access now by VBA (from Word) the drop down element.
I would like to pick the possible values out those the
drop-down control have. I would like to thus access the form
directly. Not on the values the one contact has.
Sorry for my english.
 
Hallo Sue,
how do I get a Item(Object) of my "MassageClass"?
How do I receive an object from my Custom form, which the
Contact marked at present has?

[...]
Dim objOutlook As Outlook.Application
Dim objExplorer As Explorer
Dim objContact As ContactItem
Set objOutlook = CreateObject("Outlook.Application")
Set objExplorer = objOutlook.ActiveExplorer
Set objContact = objExplorer.Selection(1)

Set objPage =
objContact.GetInspector.ModifiedFormPages("NameOfPage")
Set objControl = objPage.Controls("NameOfComboBox")
MyValue = objControl.Value
[...]

If I implement this code, I obtain only the present value of
the ComboBox - thus the value that my contact in the field
has. I would like to have however gladly all values of the
ComboBox, which stand in the Custom MassageClass by default
to selection.
I access over VBA to Outlook. I cannot use VB-Script of
examples.
 
Repeating what I said earlier: The List or Column property of the [combo box] control returns an array of values for the control rows and columns.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


Markus Beck said:
Hallo Sue,
how do I get a Item(Object) of my "MassageClass"?
How do I receive an object from my Custom form, which the
Contact marked at present has?

[...]
Dim objOutlook As Outlook.Application
Dim objExplorer As Explorer
Dim objContact As ContactItem
Set objOutlook = CreateObject("Outlook.Application")
Set objExplorer = objOutlook.ActiveExplorer
Set objContact = objExplorer.Selection(1)

Set objPage =
objContact.GetInspector.ModifiedFormPages("NameOfPage")
Set objControl = objPage.Controls("NameOfComboBox")
MyValue = objControl.Value
[...]

If I implement this code, I obtain only the present value of
the ComboBox - thus the value that my contact in the field
has. I would like to have however gladly all values of the
ComboBox, which stand in the Custom MassageClass by default
to selection.
I access over VBA to Outlook. I cannot use VB-Script of
examples.

im Newsbeitrag See http://www.outlookcode.com/article.aspx?ID=38, the
section on unbound controls, for basic control syntax. The
List or Column property of the control returns an array of
values for the control rows and columns.


Markus Beck said:
Hello,
i adapted the form for contact and provided therein a
drop-down control. This drop-down control has given values.
The new Contact-Form is assigned to all contacts. I would
like to access now by VBA (from Word) the drop down
element.
I would like to pick the possible values out those the
drop-down control have. I would like to thus access the
form
directly. Not on the values the one contact has.
Sorry for my english.
 
Back
Top