S
SS
Hello all,
I have multiple text boxes (Text Box selection from the Control Toolbox) in
a word document. Most of the books I have read talks about how to work with
controls on a userform but not with controls on the application itself
(Microsoft Word).
The code below is for accessing text boxes in a userform. How can I achieve
the same thing if all my text boxes were on a Microsoft Word document?
When I type in Debug.Print(ThisDocument.controls.count) it doesn't recognize
the text boxes I have on the document.
Please help. Thanks in advance.
SS
Dim ctrl as MSForms.Control
For Each ctlr in Me.Controls
If TypeOf ctrl is MSForms.TextBox Then
' reset if the current control is a textbox:
ctrl.value = ""
End If
Next
I have multiple text boxes (Text Box selection from the Control Toolbox) in
a word document. Most of the books I have read talks about how to work with
controls on a userform but not with controls on the application itself
(Microsoft Word).
The code below is for accessing text boxes in a userform. How can I achieve
the same thing if all my text boxes were on a Microsoft Word document?
When I type in Debug.Print(ThisDocument.controls.count) it doesn't recognize
the text boxes I have on the document.
Please help. Thanks in advance.
SS
Dim ctrl as MSForms.Control
For Each ctlr in Me.Controls
If TypeOf ctrl is MSForms.TextBox Then
' reset if the current control is a textbox:
ctrl.value = ""
End If
Next