Fastest way to get rid of live links

K

kevs

The annoying feature that creates live e mail and web links --
What is fastest way to eliminate the from a full word document, and then get
rid of it altogether? Thanks.



OS 10.4.7
Office 2004
 
J

JE McGimpsey

kevs said:
The annoying feature that creates live e mail and web links --
What is fastest way to eliminate the from a full word document, and then get
rid of it altogether? Thanks.

One way to get rid of links:

Public Sub RemoveHyperlinks()
Dim hLink As Hyperlink
For Each hLink In ActiveDocument.Hyperlinks
hLink.Delete
Next hLink
End Sub



To stop new links:

Tools/Autocorrect/Autoformat As You Type, uncheck the "Internet paths
with hyperlinks". You could have found this in Word Help ("Turn on or
off automatic formatting of hyperlinks")
 
J

John McGhie [MVP - Word and Word Macintosh]

Hi Kevs:

Run this Macro to remove them:

Sub Main()
' Removes hyperlinks from document
' Macro written 1 Aug 2001 by John McGhie

For i = ActiveDocument.Hyperlinks.Count To 1 Step -1
ActiveDocument.Hyperlinks(i).Delete
Next i

End Sub

The macro works backwards up a Word document, otherwise the collection
renumbers during the run and you delete only every "second" hyperlink :)

To stop them happening, go to Tools>AutoCorrect>AutoFormat As You Type and
switch OFF "Internet paths with hyperlinks".

Cheers

The annoying feature that creates live e mail and web links --
What is fastest way to eliminate the from a full word document, and then get
rid of it altogether? Thanks.



OS 10.4.7
Office 2004

--

Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.

John McGhie <[email protected]>
Microsoft MVP, Word and Word for Macintosh. Business Analyst, Consultant
Technical Writer.
Sydney, Australia +61 (0) 4 1209 1410
 
J

JE McGimpsey

JE McGimpsey said:
One way to get rid of links:

Oops, use John McGhie's macro instead. I'd forgotten that Word provides
a reference to the collection rather than the collection's elements, so,
when it's used in a For Each loop, it doesn't actually address *each*
element, but rather an index into the collection.

Therefore it will skip every other element.

This is different from the way XL handles the same control loop.
 
J

John McGhie [MVP - Word and Word Macintosh]

I spent many hours of swearing before I understood that :)

Hyperlinks are not the only collection that does it: Bookmarks, Footnotes,
Index tags, cross-references... There's quite a few. And it's a PITA :)

I seem to remember that "Rows" in Excel do the same thing (at least on the
PC...). Is that not correct?

Cheers

Oops, use John McGhie's macro instead. I'd forgotten that Word provides
a reference to the collection rather than the collection's elements, so,
when it's used in a For Each loop, it doesn't actually address *each*
element, but rather an index into the collection.

Therefore it will skip every other element.

This is different from the way XL handles the same control loop.

--

Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.

John McGhie <[email protected]>
Microsoft MVP, Word and Word for Macintosh. Business Analyst, Consultant
Technical Writer.
Sydney, Australia +61 (0) 4 1209 1410
 
J

JE McGimpsey

Is that not correct?

Yes, you're right - Rows and Columns have a lot of idiosyncrasies. Since
I've long learned to deal with them, I'd forgotten.

Thanks again!
 
K

Kurt

I spent many hours of swearing before I understood that :)

Hyperlinks are not the only collection that does it: Bookmarks, Footnotes,
Index tags, cross-references... There's quite a few. And it's a PITA :)

I seem to remember that "Rows" in Excel do the same thing (at least on the
PC...). Is that not correct?

On Mac Excel, yes, and always a major pain in the butt if you don't
immediately delete the link after entering the email address.
The macro helps, but you've got to deal with the macro nag screen every
time you open the document.
 
K

Kurt

JE McGimpsey said:
Yes, you're right - Rows and Columns have a lot of idiosyncrasies. Since
I've long learned to deal with them, I'd forgotten.

Thanks again!

Why do you suppose MS never made this a preference, rather than a
hardwired annoyance?
 
D

Daiya Mitchell

Kurt said:
"John McGhie [MVP - Word and Word Macintosh]" <[email protected]>
wrote:

Is that not correct?
Yes, you're right - Rows and Columns have a lot of idiosyncrasies. Since
I've long learned to deal with them, I'd forgotten.

Thanks again!

Why do you suppose MS never made this a preference, rather than a
hardwired annoyance?

Made *what* a preference? Getting rid of live links? Preferences should
not change the content of a document.

There are tons of hardwired annoyances--the way for MS to solve most of
them would not be yet another preference, but probably a predefined
command that could be easily accessed without a macro.
 
P

Peter Jamieson

Why do you suppose MS never made this a preference, rather than a
hardwired annoyance?

Made what a preference? The behaviour of the object model? The behaviour of
For Each loops in VBA?

I like clarity and certainty as much as the next programmer but it's
extremely difficult to achieve, and in fact I see no reason to assume that
/complete/ clarity or reliability are even possible. Do you?

Peter Jamieson
 
K

Kurt

Daiya Mitchell said:
Kurt said:
"John McGhie [MVP - Word and Word Macintosh]" <[email protected]>
wrote:


Is that not correct?

Yes, you're right - Rows and Columns have a lot of idiosyncrasies. Since
I've long learned to deal with them, I'd forgotten.

Thanks again!

Why do you suppose MS never made this a preference, rather than a
hardwired annoyance?

Made *what* a preference? Getting rid of live links? Preferences should
not change the content of a document.

There are tons of hardwired annoyances--the way for MS to solve most of
them would not be yet another preference, but probably a predefined
command that could be easily accessed without a macro.

Hey, anything that makes it more intuitive for the user.
The trick for them, of course, is providing easily searchable
documentation that enables the user to actually do this.
They aren't so good in this department.
 
K

Kurt

Why do you suppose MS never made this a preference, rather than a
hardwired annoyance?

Made what a preference? The behaviour of the object model? The behaviour of
For Each loops in VBA?

I like clarity and certainty as much as the next programmer but it's
extremely difficult to achieve, and in fact I see no reason to assume that
/complete/ clarity or reliability are even possible. Do you?
[/QUOTE]

Those days are apparently gone.
 
J

John McGhie [MVP - Word and Word Macintosh]

If you're running an AntiVirus program, you can turn the nag off.
Excel>Preferences>Security...

In Word, the Nag won't occur if you store macro templates in your "Trusted"
locations (My Templates, and whatever you have Workgroup Templates set to).

In Word, you can turn off the AutoFormat As You Type kludge that produced
blue measles all over your document. In Excel, they forgot that "every
feature you can't turn off is a bug" :)

Cheers


On Mac Excel, yes, and always a major pain in the butt if you don't
immediately delete the link after entering the email address.
The macro helps, but you've got to deal with the macro nag screen every
time you open the document.

--

Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.

John McGhie <[email protected]>
Microsoft MVP, Word and Word for Macintosh. Business Analyst, Consultant
Technical Writer.
Sydney, Australia +61 (0) 4 1209 1410
 
C

Clive Huggan

Hello Kevs,

If you don't have enough of them that you want to use the macro, try these
-- from page 60 of "Bend Word to Your Will", a free download from the Word
MVPs' website (http://word.mvps.org/Mac/Bend/BendWordToYourWill.html).

To turn off active formatting of a hyperlink, select the hyperlink by
clicking outside it and dragging inwards or by putting the insertion point
after the hyperlink, holding down the shift key and pressing the left-arrow
to select it. Then key Command-k » click the ³Remove link² button at bottom
left. Before Word 2004, you can Control-click the hyperlink (right-click on
a two-button mouse), which presents you with an Edit Hyperlink option. In
Word 2004 I key Command-Shift-F9.

You can search for the next hyperlink by holding down the circular button on
the document¹s vertical scroll bar, rolling to the ³{a}² area (fields) in
the box that appears, letting the mouse button go, then clicking on either
of the grey double arrows above and below the circular button. Keying
Command-y will repeat the action of removing the link.

If you want to stop Word automatically hyperlinking every web address you
type, choose Tools menu » AutoCorrect » ³AutoFormat as you type². In the
³Replace as you type² section, de-select ³Internet paths with hyperlinks².
You can always reinstate this setting if you need to hyperlink web addresses
in future.

Cheers,
Clive Huggan
============
 
K

kevs

Sub Main()
' Removes hyperlinks from document
' Macro written 1 Aug 2001 by John McGhie

For i = ActiveDocument.Hyperlinks.Count To 1 Step -1
ActiveDocument.Hyperlinks(i).Delete
Next i

End Sub
Thanks john
How do I run macro?
Doesn't it have to already be in macro list to run it?
I tried to create a new one with that text, but no option to paste it in



OS 10.4.7
Office 2004
 
K

kevs

Hi Kevs:

Did you look in the Help? :)

See here: http://word.mvps.org/mac/installmacro.html

Cheers
Thanks John, it worked. It screwed up before cause I had spaces in the name.
I put it in the toolbar, but is there anyway to change the name to a shorter
name than: normal.newmacros.GetRidofLinks

Hey did you notice when you create a macro in upper right you see a
navigation box that looks like Windows XP?
OS 10.4.7
Office 2004
 
J

John McGhie [MVP - Word and Word Macintosh]

Hi Kevs:

If you go into Tools>Customise and then right-click the button and choose
Properties, you can type any name you want for the macro.

If you're asking "Can you make the actual displayed name shorter", not
really (you can, but it's a fiddle and it affects all macros and may give
strange side-effects).

The entire Visual Basic Editor is ported from the Windows environment with
as few changes as possible, so I would not be surprised if it looks a little
"Windows-like" :)

Do me a favour? Top post, in here. It makes it so much quicker when I'm
trying to get through a lot of posts in a short time if I don't have to stop
and scroll them.

Thanks


Thanks John, it worked. It screwed up before cause I had spaces in the name.
I put it in the toolbar, but is there anyway to change the name to a shorter
name than: normal.newmacros.GetRidofLinks

Hey did you notice when you create a macro in upper right you see a
navigation box that looks like Windows XP?
OS 10.4.7
Office 2004

--

Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.

John McGhie <[email protected]>
Microsoft MVP, Word and Word for Macintosh. Business Analyst, Consultant
Technical Writer.
Sydney, Australia +61 (0) 4 1209 1410
 

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