Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
I am moving an Excel spreadsheet with about 3000 hyperlinks from C: drive to
U: drive (servor) and need to revise the hyperlinks accordingly. While I'm at it, I can take an unneccessary folder (....../folder/....) out of the address. I tried writing VBA to do this without success. Suggestions? Thank you in advance. Doug |
#2
![]() |
|||
|
|||
![]()
Hi Doug
I copy this from David McRitchie his site http://www.mvps.org/dmcritchie/excel/buildtoc.htm#hyp Sub Fix192Hyperlinks() Dim OldStr As String, NewStr As String OldStr = "http://192.168.15.5/" NewStr = "http://hank.home.on.ca/" Dim hyp As Hyperlink For Each hyp In ActiveSheet.Hyperlinks hyp.Address = Replace(hyp.Address, OldStr, NewStr) Next hyp End Sub If you want to fix the display text you can also include .TextToDisplay -- Regards Ron de Bruin http://www.rondebruin.nl "DougM" wrote in message ... I am moving an Excel spreadsheet with about 3000 hyperlinks from C: drive to U: drive (servor) and need to revise the hyperlinks accordingly. While I'm at it, I can take an unneccessary folder (....../folder/....) out of the address. I tried writing VBA to do this without success. Suggestions? Thank you in advance. Doug |
#3
![]() |
|||
|
|||
![]()
This is helpful but I think it doesn't solve my problem. Thank you.
It looks like this solution replaces old with new. I need to edit each hyp the same way (ie c:\target\folder\folder\filename to u:\target\folder\filename) because each hyp goes to a different file. Thanks again and in advance. Doug "Ron de Bruin" wrote: Hi Doug I copy this from David McRitchie his site http://www.mvps.org/dmcritchie/excel/buildtoc.htm#hyp Sub Fix192Hyperlinks() Dim OldStr As String, NewStr As String OldStr = "http://192.168.15.5/" NewStr = "http://hank.home.on.ca/" Dim hyp As Hyperlink For Each hyp In ActiveSheet.Hyperlinks hyp.Address = Replace(hyp.Address, OldStr, NewStr) Next hyp End Sub If you want to fix the display text you can also include .TextToDisplay -- Regards Ron de Bruin http://www.rondebruin.nl "DougM" wrote in message ... I am moving an Excel spreadsheet with about 3000 hyperlinks from C: drive to U: drive (servor) and need to revise the hyperlinks accordingly. While I'm at it, I can take an unneccessary folder (....../folder/....) out of the address. I tried writing VBA to do this without success. Suggestions? Thank you in advance. Doug |
#4
![]() |
|||
|
|||
![]()
Try it
It use replace to change the path not the file name -- Regards Ron de Bruin http://www.rondebruin.nl "DougM" wrote in message ... This is helpful but I think it doesn't solve my problem. Thank you. It looks like this solution replaces old with new. I need to edit each hyp the same way (ie c:\target\folder\folder\filename to u:\target\folder\filename) because each hyp goes to a different file. Thanks again and in advance. Doug "Ron de Bruin" wrote: Hi Doug I copy this from David McRitchie his site http://www.mvps.org/dmcritchie/excel/buildtoc.htm#hyp Sub Fix192Hyperlinks() Dim OldStr As String, NewStr As String OldStr = "http://192.168.15.5/" NewStr = "http://hank.home.on.ca/" Dim hyp As Hyperlink For Each hyp In ActiveSheet.Hyperlinks hyp.Address = Replace(hyp.Address, OldStr, NewStr) Next hyp End Sub If you want to fix the display text you can also include .TextToDisplay -- Regards Ron de Bruin http://www.rondebruin.nl "DougM" wrote in message ... I am moving an Excel spreadsheet with about 3000 hyperlinks from C: drive to U: drive (servor) and need to revise the hyperlinks accordingly. While I'm at it, I can take an unneccessary folder (....../folder/....) out of the address. I tried writing VBA to do this without success. Suggestions? Thank you in advance. Doug |
#5
![]() |
|||
|
|||
![]()
I tried running this without success. Can anybody tell me why?
Sub Fix192Hyperlinks() ' Dim OldStr As String, NewStr As String OldStr = "c:\My Templates\Profile Database\" NewStr = "\\Pinoak\Data\Mfr\Grinding Room\" Dim hyp As Hyperlink For Each hyp In ActiveSheet.Hyperlinks hyp.Address = Replace(hyp.Address, OldStr, NewStr) Next hyp End Sub Thank you "Ron de Bruin" wrote: Try it It use replace to change the path not the file name -- Regards Ron de Bruin http://www.rondebruin.nl "DougM" wrote in message ... This is helpful but I think it doesn't solve my problem. Thank you. It looks like this solution replaces old with new. I need to edit each hyp the same way (ie c:\target\folder\folder\filename to u:\target\folder\filename) because each hyp goes to a different file. Thanks again and in advance. Doug "Ron de Bruin" wrote: Hi Doug I copy this from David McRitchie his site http://www.mvps.org/dmcritchie/excel/buildtoc.htm#hyp Sub Fix192Hyperlinks() Dim OldStr As String, NewStr As String OldStr = "http://192.168.15.5/" NewStr = "http://hank.home.on.ca/" Dim hyp As Hyperlink For Each hyp In ActiveSheet.Hyperlinks hyp.Address = Replace(hyp.Address, OldStr, NewStr) Next hyp End Sub If you want to fix the display text you can also include .TextToDisplay -- Regards Ron de Bruin http://www.rondebruin.nl "DougM" wrote in message ... I am moving an Excel spreadsheet with about 3000 hyperlinks from C: drive to U: drive (servor) and need to revise the hyperlinks accordingly. While I'm at it, I can take an unneccessary folder (....../folder/....) out of the address. I tried writing VBA to do this without success. Suggestions? Thank you in advance. Doug |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Address List in Excel | Excel Discussion (Misc queries) | |||
Hyperlinks from one document to another document on a different dr | Charts and Charting in Excel | |||
HOW DO I ENTER TWO NAMES IN ONE ROW FOR ONE ADDRESS FOR LABELS | Excel Discussion (Misc queries) | |||
Relative Hyperlinks to PDFs (or other documents) | Excel Discussion (Misc queries) | |||
Hyperlinks - identifying source in destination sheet | Excel Discussion (Misc queries) |