Need Macro to Lock all Links

M

MKG

I need a macro which will lock all links in the document on screen. For Word
2003.

There are two ways we can do this manually:
1. Select the entire document and press Ctrl+F11
2. Edit-Links-(Select all links in document), click Locked under "update
method for selected link")

But I need a macro to do this since the users who need to take these actions
may find the process confusing. I haven't been able to record a macro to do
this.

Can anyone provide me with the code to do this?
 
L

Lene Fredborg

You can use something like the following:

Dim oField As Field

For Each oField In ActiveDocument.Fields
'You may need to check other types of fields too
If oField.Type = wdFieldLink Then
oField.Locked = True
End If
Next oField

To unlock the fields, Locked = false

Note: If you select the entire document and press Ctrl+F11, you lock _all_
fields (incl. cross-references etc.). This may not be what you want.

--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 
M

MKG

Perfect! I was even able to interpolate your code to fit the type of fields
in use, so I've gotten exactly what I needed.

Thank you very much!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top