View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.links
Davius Davius is offline
external usenet poster
 
Posts: 7
Default Hyperlink File Path Changes. Hair loss imminent.

On Aug 21, 5:10*pm, Bill Manville wrote:
I guess the spreadsheet containing the hyperlinks is located in the
IMAGES folder. *The hyperlinks are relative to the location of the
spreadsheet.

Something like this might do it:

Sub ChangeHype()
* Dim WS As Worksheet
* Dim H As Hyperlink
* For Each WS In ActiveWorkbook.Worksheets
* * For Each H In WS.Hyperlinks
* * * ' change it to start after the last \
* * * H.Address = Mid(H.Address,InStrRev(H.Address,"\"))
* * Next
* Next
End Sub

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - respond to newsgroup



Thats correct the Spreadsheet is now in the folder along with all of
the images. I tried the above and got a Runtime error '5' "invalid
procedure call or argument.

I also tried different filepaths in this line:

H.Address = Mid(H.Address,InStrRev(H.Address,"\"))

such as H.Address = Mid(H.Address,InStrRev(H.Address,"\images"))

"d:\documents\shared\images"

with and without the final backslash, am I missing something or is my
problem greater than this?

Really appreciate your input.