Word TextBox ContentControl with border what can be controlled with VBA

44 Views Asked by At

I relatively new to these depths of Word!

I try to make a textbox, what I can hide if a Content Control Dropdown is set to a specific value, but when it is visible it's text should be resetted to a given value, but most importantly it should have a border around it.

As RichText and PlainText Content control don't have the option to have border and fix size (or at least I can't find an option to set them), I wanted to use TextBox Form (what at least have a border and fix size)

My problem, when I try to access the FormField (guess old TextBox from Tools from Previous Version is that), it is not detected. I tried ActiveDocument.FormFields("textbox1"). with no result, and tried to detect it in any way, but for example Activedocument.FormFields.Count gives me a "0" result, so basically I can't access this TextBox.

So I asking, how can I make a TextBox in Word, what:

  • Has a border
  • Can be fixed size
  • Can be manipulated with VBA

What I want to use it for?

I have two rows with a DropDown contentControl, and when I use change it, I want to change the textbox too. For example, if the Dropdown value is "None", then I want to hide it, and for example if it anything else, I want to put a default text in it. Also - if it is possible - I want to check how many characters are typed into it (I want to limit it depending on the dropdown value), but this is just an extra.

Thanks for any help!

  1. I tried to access the FormField with Activedocument.FormFields("name-of-the-formfield")
  2. Tried to put border and fix size around a Plain Text/ rich Teyt Content Control
  3. Googled for days
0

There are 0 best solutions below