How do I globally turn off hyperlink formatting?

V

Viking

I have a document with a large number of hyperlinks in it. I wish to turn
off the hyperlink formatting globally. I know how to do this on individual
links, but not how to do the entire document at one time.
 
B

Brian

Had the same problem myself.

Try the following:

Sub ChangeHyperlinkField()
Dim iFld As Integer
Dim strCodes As String
Selection.HomeKey
strCodes = ActiveDocument.ActiveWindow.View.ShowFieldCodes
ActiveDocument.ActiveWindow.View.ShowFieldCodes = True
For iFld = ActiveDocument.Fields.Count To 1 Step -1
With ActiveDocument.Fields(iFld)
.Unlink
End With
Next iFld
ActiveDocument.ActiveWindow.View.ShowFieldCodes = strCodes
End Sub


Hope it helps.
 
L

Lene Fredborg

The macro above will unlink _all_ types of fields (cross-references, TOC,
etc.). To prevent this and unlink only hyperlinks, replace:

.delete

by

If .Type = wdFieldHyperlink Then
.Unlink
End If

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

Mandarin

Surely this would be easier - from Word Help

Click the Microsoft Office Button , and then click Word Options.
Click Proofing.
Click AutoCorrect Options, and then click the AutoFormat As You Type tab.
Select the Internet and network paths with hyperlinks check box.

Mike
 
L

Lene Fredborg

Changing the settings in "Autoformat As You Type" will not affect existing
text - it only affects text you type after changing the settings. Therefore,
the existing hyperlinks will not be changed to normal text even if you turn
off "Internet and network paths with hyperlinks").

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

Jay Freedman

Hi Mike,

The AutoFormatting will convert plain text into hyperlinks, but it won't
remove hyperlinks that already exist. That's what the code does.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
A

Arlene

When you go to the AutoFormat taab and uncheck Internet and network paths
with hyperlinks, how does that play in vs. unchecking the same box in
AutoFormat as you Type?

Arlene
 
S

Stefan Blom

AutoFormat As You Type settings are applied automatically as you type;
AutoFormat settings are applied when you manually run the AutoFormat command
in Word. (Note that the AutoFormat command is not available by default in
Word 2007, but you can add it to the Quick Access Toolbar, if you want to
use it. See the "Where is the AutoFormat feature?" help topic.)

--
Stefan Blom
Microsoft Word MVP


in message
 
S

Stefan Blom

As far as I can tell, Brian's code does nothing but unlinks all fields in
the main body of the document; this is not necessarily desirable (since
fields are also used for certain types of numbering, tables of contents, and
cross-references in Word).

Besides, unlinking all fields (if that is what you want) can be done more
easily with built-in commands: Ctrl+A (to select all) and then Ctrl+Shift+F9
(to unlink all fields).

For more useful answers, see the "Remove all Hyperlinks from document"
thread in this newsgroup.

--
Stefan Blom
Microsoft Word MVP


in message
 

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