Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Find and remove hyperlinks

3 views
Skip to first unread message

Terry

unread,
Dec 17, 2001, 3:56:48 PM12/17/01
to
Hello
I have a rather lengthy document. It contains approx 1000 hyperlinks.
Id like to have some code that I could simply execute that will remove the
hyperlinks on all text in the doc. Of course leaving the text there.

I tried recording a macro while doing a search/replace for the hyperlink
style (all the hyperlinks in the doc do have this style) and then removing
the link in the doc, It finds the hyperlink style, but does not remove the
hyperlink.

Can anyone suggest a sub that would do what I need?

Thank you
Terry


Terry

unread,
Dec 17, 2001, 4:15:42 PM12/17/01
to
Hello
Can anyone explain why this code works to do what I need it to. I just
threw some code together and it works..???? (I had to select all the text
in the doc first)

Sub remhyperlinks()

With ActiveDocument
Dim hl As Hyperlinks
Dim hlt As Hyperlink
Dim hlcnt As Integer
For Each hlt In ActiveDocument.Hyperlinks
hlt.Delete
Next hlt
End With
End Sub

Thank you
Terry
"Terry" <terr...@nbnet.nb.ca> wrote in message
news:k_sT7.5606$ud.7...@news-nb00s0.nbnet.nb.ca...

Russell Boyd

unread,
Dec 17, 2001, 8:52:03 PM12/17/01
to
Hi Terry,

All the hyperlinks are stored as a collection. You are running through this
collection and deleting each member.

You can use the same basic code to delete all of the fields, tables,
paragraphs or anything else that is stored as a collection within a word
document. See VBA Help on "Collections"

Regards

Russell

"Terry" <terr...@nbnet.nb.ca> wrote in message

news:2gtT7.5608$ud.7...@news-nb00s0.nbnet.nb.ca...

Terry

unread,
Dec 18, 2001, 7:19:59 AM12/18/01
to
Great

Thank you Russell.
Just knowing that makes more of the code Ive written make more sense.

Again
Thank you
Terry V
"Russell Boyd" <rus...@dramadog.com> wrote in message
news:10086401...@ns2.1earth.net...

0 new messages