Ric Barline said:
Thanks for replying. You are confusing hypertext formatting with the
hypertext itself - two different things.
Ahh! Indeed I was, and indeed it is
What I am trying to do is to remove the hyperlink from the text, but
not the text itself. Making text a hyperlink is more than just
applying a blue underlined format - it's embedding field (like a
cross reference field) into the text. If you right-click on the text
that it hypertexted, you can toggle the field to see the URL to which
it links, but in order to remove the link I need to open the link
(select Hyperlink/Edit Hyperlink) and click the "Remove Hyperlink"
button. What I want is a way to globally remove all the hyperlinks in
the document rather than having to delete them one at a time. Replace
doesn't seem to work since it does not appear that a hyperlink is a
attribute like a format, nor a special character like a paragraph
mark, tab, etc. But something tells me there is a trick way of doing
this - I just don't know what it is and can't find it in the on-line
help.
OK, by way of apology for wasting your time, and not least because it
was interesting, here is the beginning of a useful macro.
It will find the next block of text with hyperlink style (I could not
think of a better way to search for one) and remove the hyperlink data
associated with the text
Sub Hyperlink_remover()
'
' Hyperlink_remover Macro
' Macro recorded 13-05-2004 by Elliott Roper
'
Selection.Find.ClearFormatting
Selection.Find.Style = ActiveDocument.Styles("Hyperlink")
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.Range.Hyperlinks(1).Delete
End Sub
It might interest you and others how I got that (Blind leading the
blind lesson follows) I simply recorded a macro following your
directions above.
In more detail. Tools->macro->record new macro
It brings up a panel asking whether it is to be invoked by toolbar or
or keyboard. Me, I *hate* toolbars, so assigned ctrl-opt-h to it and
presssed close. Then a little (grr) toolbar pops out looking like
micro-iPod. That's the macro recorder controller. It is already
recording.
So I go through the find->format->style (hyperlink) panel and find
next. The next hyperlink in the document is highlighted. OK, so I then
go through the insert->hyperlink->remove routine (the ctrl-click
(rightclick) seems to be disabled while recording a macro), and yep,
the hyperlink stuff is no longer with the selected text. Then I reach
for the macro controller stop button and its done. Now every time I hit
ctrl-opt-h, Word scampers off to the next hyperlink and de-fuses it.
It would not be too hard to make it loop over every hyperlink. If were
doing this for myself, I'd probably make two macros, one to find the
first hyperlink block and another to delete the selected link stuff and
find the next. That way I get a chance to review what I'm about to
wreck.
There. I found that fun. I hope it's useful. (You can cut the macro out
of this article and paste it into your macro collection.)