Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default change UNC path of multiple hyperlinks

Is there anyway of changing the server name of the UNC path on a hyperlink,
within an excel sheet, after migrating a file server a few excel workbooks
which have multiple hyperlinks in each sheet have not automatically updated
to reflect the new server name.

Can this be changed without having to manually update each link which will
take forever?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default change UNC path of multiple hyperlinks

You should be able to change them with code which shouldn't take forever.

Do it manually one time to a single hyperlink with the macro recorder turned
on to get the basic code.

--
Regards,
Tom Ogilvy


"Pieman" wrote:

Is there anyway of changing the server name of the UNC path on a hyperlink,
within an excel sheet, after migrating a file server a few excel workbooks
which have multiple hyperlinks in each sheet have not automatically updated
to reflect the new server name.

Can this be changed without having to manually update each link which will
take forever?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default change UNC path of multiple hyperlinks

Take a look at David McRitchie's site:
http://www.mvps.org/dmcritchie/excel/buildtoc.htm
look for:
Fix Hyperlinks (#FixHyperlinks)

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Pieman wrote:

Is there anyway of changing the server name of the UNC path on a hyperlink,
within an excel sheet, after migrating a file server a few excel workbooks
which have multiple hyperlinks in each sheet have not automatically updated
to reflect the new server name.

Can this be changed without having to manually update each link which will
take forever?


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default change UNC path of multiple hyperlinks

Hi Tom,

Thanks for the quick reply, recording the macro gave me the code of what
happens when 1 cell is changed, for which I can easily change the range for;
however the full hyperlink address is then placed within the marco, which I
do not want. Each link may point to different share's on this new server.

Is it possible to only change the server name that the UNC is relative to
and not the full path?

"Tom Ogilvy" wrote:

You should be able to change them with code which shouldn't take forever.

Do it manually one time to a single hyperlink with the macro recorder turned
on to get the basic code.

--
Regards,
Tom Ogilvy


"Pieman" wrote:

Is there anyway of changing the server name of the UNC path on a hyperlink,
within an excel sheet, after migrating a file server a few excel workbooks
which have multiple hyperlinks in each sheet have not automatically updated
to reflect the new server name.

Can this be changed without having to manually update each link which will
take forever?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default change UNC path of multiple hyperlinks

I would try something like this:

Sub ChangeLink()
Dim hlink As Hyperlink
Dim s As String
For Each hlink In ActiveSheet.Hyperlinks
s = hlink.Address
If InStr(1, s, "//Server1", vbTextCompare) Then
s = Replace(s, "//Server1", "//Server2")
hlink.Address = s
End If
Next
End Sub


Test his on a copy of your file.

--
Regards,
Tom Ogilvy



"Pieman" wrote:

Hi Tom,

Thanks for the quick reply, recording the macro gave me the code of what
happens when 1 cell is changed, for which I can easily change the range for;
however the full hyperlink address is then placed within the marco, which I
do not want. Each link may point to different share's on this new server.

Is it possible to only change the server name that the UNC is relative to
and not the full path?

"Tom Ogilvy" wrote:

You should be able to change them with code which shouldn't take forever.

Do it manually one time to a single hyperlink with the macro recorder turned
on to get the basic code.

--
Regards,
Tom Ogilvy


"Pieman" wrote:

Is there anyway of changing the server name of the UNC path on a hyperlink,
within an excel sheet, after migrating a file server a few excel workbooks
which have multiple hyperlinks in each sheet have not automatically updated
to reflect the new server name.

Can this be changed without having to manually update each link which will
take forever?



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default change UNC path of multiple hyperlinks

Tom,

Thanks very much for that the code worked (with a slight mod); specifing the
server name with forward slash's ( / ) failed to update the links but simply
changing these to back slash's ( \ ) as per below works at treat...

Sub ChangeLink()
Dim hlink As Hyperlink
Dim s As String
For Each hlink In ActiveSheet.Hyperlinks
s = hlink.Address
If InStr(1, s, "\\Server1", vbTextCompare) Then
s = Replace(s, "\\Server1", "\\Server2")
hlink.Address = s
End If
Next
End Sub

Thaks very much for the quick response, you have saved me a whole load of
hassle.
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default change UNC path of multiple hyperlinks

I can never remember which way they lean <g

--
Regards,
Tom Ogilvy


"Pieman" wrote:

Tom,

Thanks very much for that the code worked (with a slight mod); specifing the
server name with forward slash's ( / ) failed to update the links but simply
changing these to back slash's ( \ ) as per below works at treat...

Sub ChangeLink()
Dim hlink As Hyperlink
Dim s As String
For Each hlink In ActiveSheet.Hyperlinks
s = hlink.Address
If InStr(1, s, "\\Server1", vbTextCompare) Then
s = Replace(s, "\\Server1", "\\Server2")
hlink.Address = s
End If
Next
End Sub

Thaks very much for the quick response, you have saved me a whole load of
hassle.

Reply
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
change multiple hyperlinks in worksheet Pieman Links and Linking in Excel 0 February 5th 07 01:52 PM
How to change multiple hyperlinks at the same time RichardInHouston Excel Discussion (Misc queries) 0 October 24th 06 11:42 PM
Why would hyperlinks in a spreadsheet change to an invalid path? LisaW Excel Discussion (Misc queries) 1 September 19th 06 05:38 PM
Hyperlinks change path on save in Excel 2003 Flyboy Excel Worksheet Functions 1 November 5th 05 04:53 PM
Can i change multiple hyperlinks at once Magser Excel Discussion (Misc queries) 3 October 25th 05 05:01 PM


All times are GMT +1. The time now is 10:49 PM.

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

About Us

"It's about Microsoft Excel"