Roderick
02-23-2019, 04:50 AM
I have a template with a number of fields and the following code updates these:
For Each oStory In ActiveDocument.StoryRanges
Do
oStory.Fields.Update
Set oStory = oStory.NextStoryRange
Loop Until oStory Is Nothing
Next
However, I've got a number of Fill-in fields populated with a style I created. The quantity of these fields can vary as the user applies them to the document.
When I run the above procedure, I want the code to avoid updating the Fill-in fields. At the moment I can do this manually going to each one and using Ctrl+F11. When the field update has completed I go back to each Fill-in field and unlock it by using Ctrl+Shift+F11.
What I want VBA to do is go through the document, going to each of these Fill-in fields and apply the code of:
Selection.Fields.Locked = False
...and then reversing the lock at the end of the above process using the "True" command.
At the moment, I don't know how to use the process of either finding each Fill-in field, using VBA, and lock it or use the field plus the style that goes with it and then lock it. That style is called "Appendix Title".
Can someone please give me some ideas?
Thanks
Roderick
For Each oStory In ActiveDocument.StoryRanges
Do
oStory.Fields.Update
Set oStory = oStory.NextStoryRange
Loop Until oStory Is Nothing
Next
However, I've got a number of Fill-in fields populated with a style I created. The quantity of these fields can vary as the user applies them to the document.
When I run the above procedure, I want the code to avoid updating the Fill-in fields. At the moment I can do this manually going to each one and using Ctrl+F11. When the field update has completed I go back to each Fill-in field and unlock it by using Ctrl+Shift+F11.
What I want VBA to do is go through the document, going to each of these Fill-in fields and apply the code of:
Selection.Fields.Locked = False
...and then reversing the lock at the end of the above process using the "True" command.
At the moment, I don't know how to use the process of either finding each Fill-in field, using VBA, and lock it or use the field plus the style that goes with it and then lock it. That style is called "Appendix Title".
Can someone please give me some ideas?
Thanks
Roderick