PDA

View Full Version : Need macro to select all fields on a document at one time



kmw75
06-11-2014, 01:12 PM
Hi Everyone, I am using Word 2010. I'm working for a law firm and we have legal software called ProLaw that runs merges with Word. Issue is that these documents have legal text that can not be changed. When the merges run, the entire file is editable.
I found a way to record a macro for one document, its only one page long, to select the field from ProLaw and mark that selection as the only part of the file that can be edited. Works exactly as I need.

Now the problem comes in that I have about 100 other documents that have many fields and many pages in one document. I can not find a way to select multiple occurrences of different fields from ProLaw on my document and select all of them at once.

This is my recorded macro. This was just done with a couple sequential lines of text on a blank page to see if I can make it work.


Sub ProLawTest1()
'
' ProLawTest1 Macro
'
'
Selection.MoveDown Unit:=wdLine, Count:=5
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Editors.Add wdEditorEveryone
ActiveDocument.Protect Password:="NoChange", NoReset:=False, Type:= _
wdAllowOnlyReading, UseIRM:=False, EnforceStyleLock:=False
Selection.HomeKey Unit:=wdStory
End Sub


Basically what this recorded macro does is select the text I want our clerical staff to be able to edit. Then from the review menu, chooses restrict editing from the protect menu, 1 is unchecked, 2 is checked and No Changes (Read only) is selected and then any selected text at that time I set as the exception and check the box for Everyone and then password protect it.

Do you know what I can use instead to select all form fields in a document no matter where in the document they are and no matter how many there are or what they are called? When I record a macro it only follows my movements and I can not select more then one field at a time and I'm not sure how to make it even find each next instance of a field.

The field code from ProLaw looks like this: «Matter Matter ID»

I have tried to do an edit find for this field on the page when recording a macro and it doesn't seem to work. I am having trouble finding this information online, which is what led me to this forum. This is fairly urgent for us. Thank you for any help!!!!

macropod
06-11-2014, 05:44 PM
Cross-posted at: http://answers.microsoft.com/en-us/office/forum/office_2010-word/macro-in-word-needed-which-will-select-all-mail/30d89692-e47b-43ce-8c2a-e8270c910ff2
and at:http://www.tek-tips.com/viewthread.cfm?qid=1733118

For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184