Thread: Edit Hyperlinks
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
SLKoelker SLKoelker is offline
external usenet poster
 
Posts: 19
Default Edit Hyperlinks

Maybe I am not doing this correctly, cause I couldn't get it to work. Does it
make a difference that this is not a connection to a website, but a
connection to a document on a shared drive? Here is what the correct map
looks like when I fix it:
file:///\\MIAVS02\MIAFS03\MIA\Directorate_Shared\QA\M119 FAT\12591203.doc
Granted the number at the end chages according to the document I am linking
to, but the problem with the links that don't work: ......\M119 FAT\M119
FAT\......
I have just been having to delete the second M119 FAT and then they work.
Did I not ask the right question to begin with??
Hope you can help.

"JLatham" wrote:

Try this code to fix all hyperlinks in the workbook.

You'll need to change the values for BadString and GoodString - be careful
in making those entries to properly identify the bad section of the URL and
that when the second GoodString is inserted into it, that it comes out
correctly.

I recommend that you try this on a COPY of the workbook - it if works, fine,
if the URLs get messed up, you have the original to make another copy with
and try again.

Sub FixHyperlinks()
Dim anySheet As Worksheet
Dim anyHyperlink As Hyperlink
Const BadString = "/bad/part/bad/part"
Const GoodString = "/bad/part"

For Each anySheet In Worksheets
For Each anyHyperlink In ActiveSheet.Hyperlinks
anyHyperlink.Address = _
Replace(anyHyperlink.Address, BadString, GoodString)
Next
Next
End Sub

If you're unfamiliar with using the VB Editor, use [Alt]+[F11] to open the
editor, choose Insert | Module from the Editor's menus, and just paste the
code into the code area that appears. Close the editor and use Tools | Macro
| Macros and choose the FixHyperlinks entry and click the [Run] button.



"SLKoelker" wrote:

I have a shared workbook with over 2000 hyperlinks. At some point over the
weekend someone (who's rights have since been dissolved) messed up the path
to the documents I had linked. Is there any easy way to remove one section of
the link without having to go through and do each one individually? It looks
like it is mapping to the same folder twice and now nothing will open. So I
have been going in when I can and deleting that extra section to get the
hyperlink to work.

There has to be an easier way. Please help.Thanks.