Results 1 to 9 of 9
  1. #1
    3 Star Lounger
    Join Date
    Apr 2007
    Location
    Lancashire, United Kingdom
    Posts
    264
    Thanks
    32
    Thanked 5 Times in 5 Posts

    Removing multiple hyperlinks from a document?

    I have a document which has hundreds of hyperlinks in it. Is there any way to remove them all in one go?

    Alan

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    Yes, use a macro which contains lines like this

    While ActiveDocument.Hyperlinks.Count > 0
    ActiveDocument.Hyperlinks(1).Delete
    Wend
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. The Following User Says Thank You to Andrew Lockton For This Useful Post:

    alan sh (2012-03-21)

  4. #3
    3 Star Lounger
    Join Date
    Apr 2007
    Location
    Lancashire, United Kingdom
    Posts
    264
    Thanks
    32
    Thanked 5 Times in 5 Posts
    Sorted - many thanks.

    Alan

  5. #4
    3 Star Lounger
    Join Date
    Apr 2007
    Location
    Lancashire, United Kingdom
    Posts
    264
    Thanks
    32
    Thanked 5 Times in 5 Posts
    I spoke too soon. I'm gettin a run time error - "method delete of object Hyperlink failed"

    More info. It appears to have deleted about 100 of them, but there are still about 1400 left. I have tried to manually delete the first few that I have found, but it still fails with the same message.

    Alan
    Last edited by alan sh; 2012-03-21 at 08:44.

  6. #5
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    You might need to post a sample of the file so we can see what the problem is. If manually removing the Hyperlink is not possible then the macro is going to encounter problems.

    Is there something special about the hyperlinks that are still there? Is formatting important or could you convert the content to text by doing a cut/paste special?
    Are the hyperlinks you can't delete sitting in text frames or header/footers?
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  7. #6
    3 Star Lounger
    Join Date
    Apr 2007
    Location
    Lancashire, United Kingdom
    Posts
    264
    Thanks
    32
    Thanked 5 Times in 5 Posts
    I have no idea. I can delete them manually. Let me have a look and see if there is one in a text frame or picture or something weird.

    Thanks

    Alan

  8. #7
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    Without seeing a sample, I don't know what is going on - that code should have worked .

    Perhaps we should address the reason you want to remove the hyperlinks - is it just for visual reasons or is there a problem with the hyperlink data itself?
    Typically a hyperlink is formatted with a character style so it is easy to remove that by resetting the font formatting (Ctrl-Space).
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  9. #8
    3 Star Lounger
    Join Date
    Apr 2007
    Location
    Lancashire, United Kingdom
    Posts
    264
    Thanks
    32
    Thanked 5 Times in 5 Posts
    I have fixed it with your help above. There was a hyperlink embedded inside a box underneath a diagram (or inside it). It was removable manually by deleting the object. But you couldn't get to the object itself to remove the hyperlink.

    The reason to remove them? They pointed to pages on the internet - which means offline reading was no good. So, I'm redoing it all.

    Anyway, problem solved and it's full steam ahead again. Once again, many thanks for your help.

    regards

    Alan

  10. #9
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts
    If you only need to break the links, Ctrl-A, then Ctrl-Shift-F9 will do that. This leaves the hyperlinks' text in-situ.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •