Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default Edit Hyperlinks

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.

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do view and edit ALL hyperlinks in a sheet? jrh11 Excel Discussion (Misc queries) 0 September 15th 06 11:46 AM
Edit mulitple hyperlinks brodiemac Excel Discussion (Misc queries) 1 November 10th 05 08:15 PM
Edit Hyperlinks yazz22 Excel Worksheet Functions 2 January 15th 05 02:29 PM
Can VBA edit hyperlink(s) address DougM Excel Discussion (Misc queries) 4 December 16th 04 09:19 PM
Edit Hyperlinks Globally Rick@Stonybrook Excel Worksheet Functions 0 November 3rd 04 03:37 PM


All times are GMT +1. The time now is 01:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"