I have been trying to get the best VBA code for this as regards speed and accuracy. 5000 links to check and change address
I have tried exposing the code of Hyperlinks by selecting all and keypress Shift+F9. Seemed to work and then I noticed partial replacement of urls.
So next try was
This seems a slow way of replacing... Plus there did not seem to be any wildcards that would work, so if there was a subsequent find and replace for example on the word "Gent" to replace with "Gentleman", "Gentile" would be changed to "Gentlemantile"Dim doc As Document Dim link, i 'Loop through all open documents. For Each doc In Application.Documents 'Loop through all hyperlinks. doc.Hyperlinks(i).Address = Replace(doc.Hyperlinks(i).Address, "Gentiles", "Gentile") 'Other links would be here. Next Next
If there is a quicker more robust way of replacing part of the url please help.
p.s the address is custom like this "tw://[self]?Gentiles" if that makes any difference.


Reply With Quote

