PC Review


Reply
Thread Tools Rate Thread

Change Excel hyperlinks from absolute to relative

 
 
NatalieK
Guest
Posts: n/a
 
      11th Oct 2008
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 With Quote
 
 
 
 
Gary Keramidas
Guest
Posts: n/a
 
      11th Oct 2008
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" <(E-Mail Removed)> wrote in message
news:9B549853-B112-4BC0-84C3-(E-Mail Removed)...
>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 With Quote
 
NatalieK
Guest
Posts: n/a
 
      11th Oct 2008
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" <(E-Mail Removed)> wrote in message
> news:9B549853-B112-4BC0-84C3-(E-Mail Removed)...
> >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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
change hyperlinks from relative to absolute Nikki Microsoft Excel Misc 1 5th May 2009 12:31 PM
How can you change excel macros from absolute to relative? =?Utf-8?B?UmFsb25uZQ==?= Microsoft Excel Worksheet Functions 5 30th May 2006 07:40 PM
Globally change relative-addressed hyperlinks to absolute-addr =?Utf-8?B?SGVybWFuIEg=?= Microsoft Excel Worksheet Functions 1 20th Nov 2005 01:45 AM
Relative hyperlinks change to absolute when saving in Word 2003 =?Utf-8?B?Q29zYmVy?= Microsoft Word Document Management 19 15th Jul 2005 09:57 PM
Re - Excel Help delineating Absolute and Relative Hyperlinks TKT-Tang Microsoft Excel Discussion 0 8th May 2004 10:21 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:25 PM.