Reputation: 61
Use case:
My problem is that I can't seem to do something as basic as this:
Private Sub priorityDropDownBox_Changed()
updatePriorityLabel()
End Sub
It seems that I cannot access any form field if it's a "Legacy Form Field" in the VBA code... however, if I throw an ActiveX Content Control on the page, I can access that in the code.
Is there any way to access/address that drop-down box? My entire Word form uses legacy form fields and dropdowns, so I'm hoping the answer is yes, otherwise I probably need to switch all the fields and dropdowns to ActiveX content controls.
Thanks!
Upvotes: 0
Views: 1966
Reputation: 19367
The legacy controls are members of the Selection.FormFields
collection. The do not have events, the nearest equivalents are the EntryMacro
and ExitMacro
properties.
Sub Macro2()
Selection.FormFields.Add Range:=Selection.Range, Type:=wdFieldFormDropDown
Selection.PreviousField.Select
With Selection.FormFields(1)
.Name = "Dropdown1"
.EntryMacro = "Macro1"
.ExitMacro = "Macro2"
.Enabled = True
.OwnHelp = False
.HelpText = ""
.OwnStatus = False
.StatusText = ""
End With
Selection.FormFields("Dropdown1").DropDown.ListEntries.Clear
End Sub
The ExitMacro
doesn't run on selecting, or changing, a drop-down item, but when tabbing away from the control.
There is some MS information here about these legacy controls.
Upvotes: 1