?
Solved

MS Word - Remove All hyperlinks - VBA

Posted on 2009-07-06
2
Medium Priority
?
677 Views
Last Modified: 2013-11-10
Hello,

I have a word document that has been created by copying and pasting various webpages.  The problem is that it is littered with hyperlinks that are causing problems in another process.  Is there a way to 'remove all hyperlinks' in a Word document.  Currently I can only see this being possible by manually edit each hyperlink and removing or pressing the remove hyperlink button.

If this is not possible with native features, can somone help with some simple VBA that would do this.  I created some VBA in Excel some time ago to do this - but don't have this anymore and also it had a different object model - not done any VBA in MS Word. I'm guessing it should be very simple.

Raheel
0
Comment
Question by:hennanra3
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 12

Accepted Solution

by:
geneus earned 2000 total points
ID: 24783845
This macro will remove the hyperlinks from all text in the document.
Sub RemoveHyperlinks()
 
Dim y As Long
With ActiveDocument.Hyperlinks
  For y = 1 To .Count
    .Item(1).Delete
  Next y
End With
MsgBox "Completed!"
 
End Sub

Open in new window

0
 

Author Closing Comment

by:hennanra3
ID: 31600090
Wow - that was fantastic and too easy!  Many thanks.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Make the most of your online learning experience.
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
Six Sigma Control Plans
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question