Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Change Excel hyperlinks from absolute to relative

I have a folder containing about 2000 wav files and a workbook containing
hyperlinks to these wav files. I backed up this folder several times
without problems, but suddenly managed to change the references. Instead of
the target address showing TY25-08.wav it shows
.../../../../Application%20Data/Microsoft/Excel/TY25-08.wav. I need coding
which will go down a column changing all the hperlinks. The target file name
obviously is at the end of the existing text in the address box, but is also
the Display text for the hyperlink.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Change Excel hyperlinks from absolute to relative

you can try this, just change the worksheet name and the value of the
newpath variable:

Sub test()
Dim ws As Worksheet
Dim lastrow As Long
Dim i As Long
Dim oldlink As String
Dim newlink As String
Dim fname As Variant
Dim newpath As String

Set ws = Worksheets("Sheet1")
lastrow = ws.Cells(Rows.Count, "A").End(xlUp).Row
newpath = "\\Application%20Data\Microsoft\Excel\xlstart\ "
For i = 1 To lastrow
With ws
oldlink = .Range("A" & i).Value
fname = Split(oldlink, "\")
newlink = newpath & fname(UBound(fname))
.Range("a" & i).Value = newlink
End With
Next
End Sub
--


Gary

"NatalieK" wrote in message
...
I have a folder containing about 2000 wav files and a workbook containing
hyperlinks to these wav files. I backed up this folder several times
without problems, but suddenly managed to change the references. Instead
of
the target address showing TY25-08.wav it shows
../../../../Application%20Data/Microsoft/Excel/TY25-08.wav. I need coding
which will go down a column changing all the hperlinks. The target file
name
obviously is at the end of the existing text in the address box, but is
also
the Display text for the hyperlink.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Change Excel hyperlinks from absolute to relative

I have now corrected a file with a hundred dudd links by creating this macro
and keying Ctrl+Q, down arrowing 100 times.:-

Sub ResetHyperlink()
'
' ResetHyperlink Macro
'
' Keyboard Shortcut: Ctrl+q
'
Selection.Hyperlinks(1).Address = Selection.Hyperlinks(1).TextToDisplay
End Sub

For the big files, I would like to be able to just select the hyperlinks,
and run a ResetHyperlinks Macro. It is years since I did anything in VBA, so
could you help a damsel in distress and give me the code to loop through the
range.

Thanks

"Gary Keramidas" wrote:

you can try this, just change the worksheet name and the value of the
newpath variable:

Sub test()
Dim ws As Worksheet
Dim lastrow As Long
Dim i As Long
Dim oldlink As String
Dim newlink As String
Dim fname As Variant
Dim newpath As String

Set ws = Worksheets("Sheet1")
lastrow = ws.Cells(Rows.Count, "A").End(xlUp).Row
newpath = "\\Application%20Data\Microsoft\Excel\xlstart\ "
For i = 1 To lastrow
With ws
oldlink = .Range("A" & i).Value
fname = Split(oldlink, "\")
newlink = newpath & fname(UBound(fname))
.Range("a" & i).Value = newlink
End With
Next
End Sub
--


Gary

"NatalieK" wrote in message
...
I have a folder containing about 2000 wav files and a workbook containing
hyperlinks to these wav files. I backed up this folder several times
without problems, but suddenly managed to change the references. Instead
of
the target address showing TY25-08.wav it shows
../../../../Application%20Data/Microsoft/Excel/TY25-08.wav. I need coding
which will go down a column changing all the hperlinks. The target file
name
obviously is at the end of the existing text in the address box, but is
also
the Display text for the hyperlink.




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 hyperlinks from relative to absolute Nikki Excel Discussion (Misc queries) 2 April 2nd 23 01:35 PM
Relative and absolute hyperlinks Musette New Users to Excel 2 October 4th 07 06:47 AM
Absolute vs. relative hyperlinks MAB Excel Programming 5 October 11th 06 01:43 AM
How can you change excel macros from absolute to relative? Ralonne Excel Worksheet Functions 5 May 30th 06 07:40 PM
Globally change relative-addressed hyperlinks to absolute-addr Herman H Excel Worksheet Functions 1 November 20th 05 01:45 AM


All times are GMT +1. The time now is 02:30 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"