Hi All,
I have a word document with several ActiveX Textbox controls laid out in a form.
I need an event to run on the selection of those controls -
specific to the selected control. For some very odd reason Microsoft chose to remove the events for ActiveX controls, so now I'm left trying to code events to trap a change.
This will return true if my selection is within an ActiveX Content Control
Code:
Selection.Infomation(wdInformation.wdInContentControl)
Surely you'd think more could be provided by the information than just a Boolean value.
This will return Text within a specific (or known) control
Code:
ActiveDocument.ContentControls(strControlName).range.text
Where strControlName is the known title or ID of the control.... except I don't know it until it's selected.
This apparently returns the ID of the selected control - if it is in design mode
Code:
Selection.range.ContentControl(1).ID
Although I've never been able to make that work in any way... doesn't exist error.
And I can loop through all control on the document to return all control information.
Code:
For i = 1 to ActiveDocument.ContentControls(i).count
Debug.Print ActiveDocument.ContentControls(i).ID
Next i
All of this is fabulous and wonderful... except not a single method provides for the selection of the control itself.
What is the secret to returning the selected control - and it's corresponding text or information?
Alternatively - and this would be magic sauce - an AfterUpdate event of some kind for the control (doesn't exist in word, i know, but... magic.
All help appreciated.
Cheers