Solved

MS Word - Remove All hyperlinks - VBA

Posted on 2009-07-06
2
658 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
2 Comments
 
LVL 12

Accepted Solution

by:
geneus earned 500 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Access 2013 combo box not working 3 27
Copy a row 12 53
Printing A1 on A4 Printer 8 58
Please explain: Aspect Oriented Programming 2 57
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now