Here you can give the control a title, change the color, style the text and specify whether or not the control can be edited or deleted. Highlight your new form field and then click on Properties, directly below the Design Mode button. Design Mode button again to exit the mode. Put something IN a cat formfield first - otherwise you get error messages. Select the text and change it to whatever you like. there are error messages if the formfield is blank.Ĭlick Enable All to make all the formfields enabled.Ĭlick Disable Dogs to disable all non-"cat" named formfields.Ĭlick ShowCats to see the result of a specifed "cat" formfield. There are error messages to respond to invalid input.Ģ. So the only valid input to request to see the result (the content) is 1, 2, or 3. I hardcoded the fact the document has three formfields with "cat". The macro ShowCats (on the toolbar) demonstrates this. Once you build the array of "cat" formfields (FF_Array).Dim var Or, say you want to check if any of the "cat" formfields says "angora". Remember, while your formfields may be "cat1", "cat2" etc., the array is 0-based. You can use an item in the array of "cat" formfields as a formfield object.which they are.Msgbox FF_Array(0).Resultwould display the text from the first "cat" formfield found. If one does start with "cat", you add it to the array. You filter the formfield collection for the ones starting with "cat". You can disable directly using a string.Sub DogDisable()Įnd SubDisables all formfields with names NOT starting with "cat".Ĭan you make an object reference of just the ones with "cat"? Yes. They are on the top toolbar: Disable Dogs, Enable All, ShowCats.ġ. There are three macros that can be fired. I've found a few looping examples but I'm not sure if I can just create reference to all the fields I need, or will I have to loop through all the fields and check the prefix on each one?
#CREATE TEXT FORM FIELDS IN WORD CODE#
This is the code I'm wanting to apply to each one:-Īt present I've got some buttons set up to check or uncheck the 'Fill-in enabled' check box, I'd like to do this in one go if possible.Ĭan I create an object reference to all the fields that have a certain label prefix?
![create text form fields in word create text form fields in word](https://www.addictivetips.com/app/uploads/2010/05/developer.jpg)
On running the macro it would loop through all the fields that have the prefix 'cat' and leave all the ones prefixed with 'dog'. What I'm trying to do is write a macro that will execute the following code on fields that have a certain label ('bookmark' in the properties dialog) prefix.įor example the word doc may have 6 fields named:. I have a word doc that has quite a few Text Form Fields in it. Please can someone help me with this query.