Tecnik
07-09-2007, 10:23 AM
Hi there,
Please can someone help me with this query.
I have a word doc that has quite a few Text Form Fields in it. 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.
For example the word doc may have 6 fields named:-
dog1
dog2
cat1
cat2
cat3
cat4
On running the macro it would loop through all the fields that have the prefix 'cat' and leave all the ones prefixed with 'dog'.
This is the code I'm wanting to apply to each one:-
Sub check()
With Selection.FormFields(1)
.Enabled = True
End With
End Sub
At 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.
Can I create an object reference to all the fields that have a certain label prefix?
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?
Thanks in advance,
Nick
Please can someone help me with this query.
I have a word doc that has quite a few Text Form Fields in it. 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.
For example the word doc may have 6 fields named:-
dog1
dog2
cat1
cat2
cat3
cat4
On running the macro it would loop through all the fields that have the prefix 'cat' and leave all the ones prefixed with 'dog'.
This is the code I'm wanting to apply to each one:-
Sub check()
With Selection.FormFields(1)
.Enabled = True
End With
End Sub
At 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.
Can I create an object reference to all the fields that have a certain label prefix?
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?
Thanks in advance,
Nick