Hyperlinks - VBA code to change hlk address

M

Mark

I've got a few hundred MS Word docs that contain many hyperlinks to other Word and Excel files. The target files have all moved to a new server and I'd like to create code to go through all the docs and hyperlinks and replace every occurrence of "Dgkfs01" to "Dgkfs05". I've got some For...Next loops going that successfully loops through all the documents and returns the address of all the hyperlinks, but now how to change the address? There is no hyperlink base specified.
Thanks for help in advance.
 
S

Suzanne S. Barnhill

If the hyperlink field codes are displayed, you can use simple Find and
Replace. See http://www.mvps.org/word/FAQs/MacrosVBA/BatchFR.htm

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://www.mvps.org/word
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

Mark said:
I've got a few hundred MS Word docs that contain many hyperlinks to other
Word and Excel files. The target files have all moved to a new server and
I'd like to create code to go through all the docs and hyperlinks and
replace every occurrence of "Dgkfs01" to "Dgkfs05". I've got some For...Next
loops going that successfully loops through all the documents and returns
the address of all the hyperlinks, but now how to change the address? There
is no hyperlink base specified.
 
M

Mark

Hi Suzanne - my thanks for your help. Yes that was the first thing I tried when going down this road. I tried Alt+F9 to display the codes and then a search replace, but it appears not to change the underlying hyperlink address. If I change the field code using this method and then do a right click > Edit Hyperlink then the address remains unchanged.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top