I'm trying to write an VBA macro that opens some word document and
reads data from it. Unfortunately, I cannot find any info how to access
value of combo box in that document. Any idea how to do that?
(assuming that I have word.application object created and document
already opened)
Regards
Piotr
It depends on what sort of combobox it is.
If it is a combobox inserted from the "Forms" toolbar then it will
have a default bookmark name. eg the first combobox will be caled
"DropDown1". You can of course change this.
To access the selected item for this use;
X = ActiveDocument.FormFields("DropDown1").Result
If the combobox is inserted from the "Control Toolbox" toolbar then
you need to write code in the control's event procedures. eg
Private Sub ComboBox1_LostFocus()
MsgBox "current val=" & ComboBox1.Text
End Sub
Hope this helps.
Cheers
TonyS.