Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default macro/vba for a range of hyperlinks

Hello
I'm developing a library of commodity codes each entry will have a hyperlink
to the vendor cut sheet.

I need to redirect all the hyperlinks to another directory, besides going to
each hyperlink and re-educating it - I'm hoping someone can help me with a
macro or vba code.

cheers,
jkb
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default macro/vba for a range of hyperlinks

hi jkb66

Try this one

Sub tester()
Dim hlink As Hyperlink
For Each hlink In ActiveSheet.Hyperlinks
If InStr(hlink.Address, "\Data") Then
hlink.Address = Application.Substitute( _
hlink.Address, "\Data", "\Data2")
End If
Next
End Sub



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"jkb66" wrote in message ...
Hello
I'm developing a library of commodity codes each entry will have a hyperlink
to the vendor cut sheet.

I need to redirect all the hyperlinks to another directory, besides going to
each hyperlink and re-educating it - I'm hoping someone can help me with a
macro or vba code.

cheers,
jkb

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default macro/vba for a range of hyperlinks

Thanx Ron

Unfortuately the original addresses for each of the cut sheets are all in
different directories, in an effort to make this a portable list- I've copied
all the cut sheets to reside in the file location with the excel spreadsheet.

here's an example of an orginal address (I'm not responsible for the file
path!)

\\SLI0014\_017191$\4000 Eng\4700 Elect\47EX Engineering\47ES Material or
Equipment Specification\Material Cut Sheets\Power\Power Cables &
Wire\7847-PC010.PDF
but now all I need the file path to say is 7847-PC010.PDF!

I would appreciate any ideas.

jkb

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default macro/vba for a range of hyperlinks

Try this one

Sub tester2()
Dim hlink As Hyperlink
For Each hlink In ActiveSheet.Hyperlinks
hlink.Address = Mid(hlink.Address, InStrRev(hlink.Address, "\") + 1, 255)
Next
End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"jkb66" wrote in message ...
Thanx Ron

Unfortuately the original addresses for each of the cut sheets are all in
different directories, in an effort to make this a portable list- I've copied
all the cut sheets to reside in the file location with the excel spreadsheet.

here's an example of an orginal address (I'm not responsible for the file
path!)

\\SLI0014\_017191$\4000 Eng\4700 Elect\47EX Engineering\47ES Material or
Equipment Specification\Material Cut Sheets\Power\Power Cables &
Wire\7847-PC010.PDF
but now all I need the file path to say is 7847-PC010.PDF!

I would appreciate any ideas.

jkb

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default macro/vba for a range of hyperlinks

Excellent thanx Ron! that worked very well - have a great day!

jkb

"Ron de Bruin" wrote:

Try this one

Sub tester2()
Dim hlink As Hyperlink
For Each hlink In ActiveSheet.Hyperlinks
hlink.Address = Mid(hlink.Address, InStrRev(hlink.Address, "\") + 1, 255)
Next
End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"jkb66" wrote in message ...
Thanx Ron

Unfortuately the original addresses for each of the cut sheets are all in
different directories, in an effort to make this a portable list- I've copied
all the cut sheets to reside in the file location with the excel spreadsheet.

here's an example of an orginal address (I'm not responsible for the file
path!)

\\SLI0014\_017191$\4000 Eng\4700 Elect\47EX Engineering\47ES Material or
Equipment Specification\Material Cut Sheets\Power\Power Cables &
Wire\7847-PC010.PDF
but now all I need the file path to say is 7847-PC010.PDF!

I would appreciate any ideas.

jkb


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
Macro to paste hyperlinks KennyD Excel Discussion (Misc queries) 0 February 2nd 10 06:44 PM
Count hyperlinks in a mixed range Ted Stilwell Excel Worksheet Functions 2 January 31st 09 06:25 AM
macro to run on a list of hyperlinks Todd Excel Programming 1 June 27th 06 08:04 PM
Excel should let you remove hyperlinks for any range or selection Mark B Excel Discussion (Misc queries) 1 May 3rd 06 09:09 PM
Need macro help to edit hyperlinks Tomj Excel Programming 3 December 10th 05 09:45 PM


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