Hello,
I have a several textboxes in a Word 2010 document to creat a form. I am trying to find a way to clear all of them when someone wants to start over with a new entry. I already know about the resetting of protection to reset formfields, but my boss wants to use the regular text boxes. Also, I understand about using a template and how opening the template will reset the boxes when opened but I want users to be able to reset it without closing/reopening.
I can get it to work if I do each one individually, but I would rather do some code similar to the code below in case my boss adds more boxes.
The code below works great for UserForms but it does not work for the controls in the document itself.
Any help would be appreciated.
Thanks
Mark
For Each Control In Me.Controls 'Clear Input Boxes If TypeOf Control Is MSForms.TextBox Then Control.Text = "" End If If TypeOf Control Is MSForms.ComboBox Then Control.Text = "" Control.Clear End If If TypeOf Control Is MSForms.CheckBox Then Control.Value = False Control.Caption = "" Control.Visible = False End If Next
It depends whether the textboxes are inlineshapes or shapes:
if necessary change inlineshapes to shapes.Sub snb() For Each tb In ThisDocument.InlineShapes If tb.Type = 5 Then tb.OLEFormat.Object.Text = "" Next end sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks