PC Review


Reply
Thread Tools Rate Thread

Changing multiple hyperlinks

 
 
homeseal
Guest
Posts: n/a
 
      19th Oct 2003
Hi anybody!

I'm trying to change multiple hyperlinks in Excel. What I have are a
bunch of hyperlinks which point anywhere, for example:

afolder/folder1/folder3/2003.doc
or
bfolder/folder2/folder3/2003.doc

so basically the only thing in common with all these hyperlinks is that
they all point to a 2003.doc in a folder. What I need to do is change
the document name to 2004. Please tell me how I can do this! I tried
a few things but all either change the first part of a directory or
only http:// hyperlinks. Is there a way to change the hyperlinks so
that if a macro finds "2003.doc" in any part of a hyperlink, it will
change it to 2004.doc?

Puleez help me out guyz!!

Thanx!

homeseal :-)



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

 
Reply With Quote
 
 
 
 
Tom Ogilvy
Guest
Posts: n/a
 
      19th Oct 2003
With a macro

Sub changeLinks()
Dim hlink as Hyperlink
for each hlink in ActiveSheet.hyperlinks
hlink.Address = Application.substitute(hlink.Address,"2003","2004")
Next

end sub

--
Regards,
Tom Ogilvy


homeseal <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi anybody!
>
> I'm trying to change multiple hyperlinks in Excel. What I have are a
> bunch of hyperlinks which point anywhere, for example:
>
> afolder/folder1/folder3/2003.doc
> or
> bfolder/folder2/folder3/2003.doc
>
> so basically the only thing in common with all these hyperlinks is that
> they all point to a 2003.doc in a folder. What I need to do is change
> the document name to 2004. Please tell me how I can do this! I tried
> a few things but all either change the first part of a directory or
> only http:// hyperlinks. Is there a way to change the hyperlinks so
> that if a macro finds "2003.doc" in any part of a hyperlink, it will
> change it to 2004.doc?
>
> Puleez help me out guyz!!
>
> Thanx!
>
> homeseal :-)
>
>
>
> ------------------------------------------------
> ~~ Message posted from http://www.ExcelTip.com/
> ~~ View and post usenet messages directly from http://www.ExcelForum.com/
>



 
Reply With Quote
 
Harald Staff
Guest
Posts: n/a
 
      19th Oct 2003
Hi

See if this works for you (backup first and don't save afterwards unless you've tested
that it worked fine):

Sub ChangeLinks()
Dim HL As Hyperlink
Dim sOld As String, sNew As String
sOld = InputBox("Replace what:")
If sOld = "" Then Exit Sub
sNew = InputBox("Replace " & sOld & " with:")
If sNew = "" Then Exit Sub
For Each HL In ActiveSheet.Hyperlinks
HL.Address = Replace(HL.Address, sOld, sNew)
HL.TextToDisplay = Replace(HL.TextToDisplay, sOld, sNew)
Next
End Sub

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"homeseal" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi anybody!
>
> I'm trying to change multiple hyperlinks in Excel. What I have are a
> bunch of hyperlinks which point anywhere, for example:
>
> afolder/folder1/folder3/2003.doc
> or
> bfolder/folder2/folder3/2003.doc
>
> so basically the only thing in common with all these hyperlinks is that
> they all point to a 2003.doc in a folder. What I need to do is change
> the document name to 2004. Please tell me how I can do this! I tried
> a few things but all either change the first part of a directory or
> only http:// hyperlinks. Is there a way to change the hyperlinks so
> that if a macro finds "2003.doc" in any part of a hyperlink, it will
> change it to 2004.doc?
>
> Puleez help me out guyz!!
>
> Thanx!
>
> homeseal :-)
>
>
>
> ------------------------------------------------
> ~~ Message posted from http://www.ExcelTip.com/
> ~~ View and post usenet messages directly from http://www.ExcelForum.com/
>



 
Reply With Quote
 
homeseal
Guest
Posts: n/a
 
      22nd Oct 2003
Thanx guys, both work great!!!



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

 
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
Changing multiple hyperlinks Michael Microsoft Excel Misc 1 24th May 2010 12:52 PM
Changing Hyperlinks Michael Koerner Microsoft Excel Programming 2 2nd May 2009 10:15 PM
hyperlinks changing =?Utf-8?B?UGV0ZXIgRml0eg==?= Microsoft Powerpoint 2 16th Jun 2007 02:24 PM
Changing Multiple Hyperlinks =?Utf-8?B?Q2hyaXNAUERY?= Microsoft Powerpoint 3 6th Dec 2005 02:31 AM
Changing A Directory in Multiple Hyperlinks =?Utf-8?B?Y3lka2ls?= Microsoft Excel Misc 2 31st May 2004 11:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:05 PM.