Share via

hyperlink replace not working

Anonymous
2012-10-20T07:58:43+00:00

I have used Alt&F9 to view the hyperlink field codes, then Ctrl&H to replace part of the hyperlink address. It looks OK, but when I toggle Alt&F9 back to show the underlined hyperlink and go into Edit Hyperlink, the change has not taken place. If I make the same change to a single hyperlink in Edit Hyperlink, the change is OK. I need to change hundreds of hyperlinks in a document, so really need to get Find/Replace to work correctly. I am using Word 2007 in Windows Vista Home Premium. Any ideas please?

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

HansV 462.6K Reputation points
2012-10-20T10:17:03+00:00

Press Alt+F11 to activate the Visual Basic Editor.

Select Insert > Module to create a "module" where you can insert code.

Copy the code (from Sub ... up to and including End Sub) from my reply.

Paste it into the module window.

Change FindText to the text to want to search for.

Change ReplaceText to the text you want to replace it with.

With the insertion point anywhere between Sub and End Sub, press F5 to run the macro.

Press Alt+F11 to return to Word and check the result.

If it has worked OK, you can remove the code:

Press Alt+F11 again to activate the Visual Basic Editor.

Select File > Remove Module1...

Click No in the dialog that asks whether you want to export the module.

Press Alt+F4 to close the Visual Basic Editor.

Was this answer helpful?

0 comments No comments

7 additional answers

Sort by: Most helpful
  1. Suzanne S Barnhill 278.1K Reputation points MVP Volunteer Moderator
    2012-10-21T21:45:24+00:00

    My point was that, if you just changed the underlying hyperlink path, the display text would not change, which might be misleading.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2012-10-21T07:40:45+00:00

    As I said, I used Alt&F9 to view the hyperlink field codes, and that was what I was changing, not the display text. Thank you

    Was this answer helpful?

    0 comments No comments
  3. Suzanne S Barnhill 278.1K Reputation points MVP Volunteer Moderator
    2012-10-20T12:38:36+00:00

    When you use Replace to edit hyperlinks, you have to edit both the display text and the underlying field code. If you have edited the underlying field code, then the hyperlink will work even if the display text is wrong; if you edit only the display text, the hyperlink will still go to the old location. See http://WordFAQs.mvps.org/HyperlinkProbs.htm.

    Was this answer helpful?

    0 comments No comments