
Signature
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.
> Try:
>
[quoted text clipped - 7 lines]
>
> End Sub
Sorry Greg, but that only remove half the hyperlinks (try it!)
This will remove all of them
Sub ScratchMacro()
Dim iFld As Long
For iFld = ActiveDocument.Fields to 1 Step -1
If ActiveDocument.Fields(iFld).Type = wdFieldHyperlink Then
ActiveDocument.Fields(iFld).Unlink
End If
Next iFld
End Sub
Better still (i.e. quicker) is to avoid bothering with all the non-hyperlink
fields, like this
Sub ScratchMacro()
Dim iFld As Long
For iFld = ActiveDocument.Hyperlinks to 1 Step -1
ActiveDocument.Hyperlinks(1).Delete
Next iFld
End Sub
(Yes, it is repeatedly deleting the first hyperlink in the document. Think
about why that works <g>)

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
Greg Maxey - 09 Sep 2005 00:12 GMT
Jonathan,
I did try it and just tried it again. It works here to unlink 1 of 1 or 10
of 10. It unlinks all in the document.
I remember you showing the technique of working from the last to the first
using step -1 when deleting indexed items, but that doesn't appear to be
necessary in this case. At least the code I posted is working to unlink all
hyperlinks in my test document. I am using made up links like test@msn.com
etc.
.

Signature
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.
>> Try:
>>
[quoted text clipped - 33 lines]
> (Yes, it is repeatedly deleting the first hyperlink in the document.
> Think about why that works <g>)