Yet Another Remove Hyperlink Question...

W

wklind

I have several Word macros that can and do delete all hyperlinks in any
Word document. None provide what I am looking for. I need a Word macro
that will delete all external hyperlinks leaving the text in place (but
not preserving any underlines or coloring)... I also need to leave in
place any hyperlinks that are internal (bookmark) hyperlinks. I want
the macro to run without human intervention. No 'yes' or 'no'
questions.
 
D

Doug Robbins - Word MVP

The following will delete hyperlinks, leaving the text in place without
underlines or colouring while preserving cross-references to bookmarks in
the document.

Dim i As Long, hrange As Range, htext As String
With ActiveDocument
For i = .Hyperlinks.Count To 1 Step -1
Set hrange = .Hyperlinks(i).Range
htext = hrange.Text
hrange.Delete
hrange.InsertBefore htext
Next i
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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