PC Review


Reply
Thread Tools Rate Thread

How do I change all of the hyperlinks at the same time in Excel?

 
 
Jared
Guest
Posts: n/a
 
      19th May 2006
I am currently working on a project to hyperlink many bookmarked word
documents to a spreadsheet on Excel 2003. It will have probably a
hundred links. However, All of the word documents are saved on my
computer but eventually they will be saved in a different location but
with the same name. I don't want to do all of the hyperlinks until I
am sure that I will be able to change all of them without doing them
one by one again. I hyperlinked a few and then tried to use this code
to see if the hyperlinks would change anything on it:
Sub FixHiperlinks()
Dim OldStr As String, NewStr As String
OldStr = "D:\Documents and Settings"
NewStr = "Jared is the man"
Dim hyp As Hyperlink
For Each hyp In ActiveSheet.Hyperlinks
hyp.Adress = Replace(hyp.Address, OldStr, NewStr)
Next hyp
End Sub

I know that I don't actually want to change them yet and of course I
would never change them to "Jared is the man" but I just wanted to see
if the hyperlinks would change, however, when I tried to run this code
as a macro I got a message that says,
"Object doesn't support this property or method"

I know I'm probably doing something stupid, but can anyone help me know
what I'm doing wrong?

 
Reply With Quote
 
 
 
 
Chip Pearson
Guest
Posts: n/a
 
      19th May 2006
Jared.

hyp.Adress = Replace(hyp.Address, OldStr, NewStr)
should be
hyp.Address = Replace(hyp.Address, OldStr, NewStr)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Jared" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I am currently working on a project to hyperlink many bookmarked
>word
> documents to a spreadsheet on Excel 2003. It will have
> probably a
> hundred links. However, All of the word documents are saved on
> my
> computer but eventually they will be saved in a different
> location but
> with the same name. I don't want to do all of the hyperlinks
> until I
> am sure that I will be able to change all of them without doing
> them
> one by one again. I hyperlinked a few and then tried to use
> this code
> to see if the hyperlinks would change anything on it:
> Sub FixHiperlinks()
> Dim OldStr As String, NewStr As String
> OldStr = "D:\Documents and Settings"
> NewStr = "Jared is the man"
> Dim hyp As Hyperlink
> For Each hyp In ActiveSheet.Hyperlinks
> hyp.Adress = Replace(hyp.Address, OldStr, NewStr)
> Next hyp
> End Sub
>
> I know that I don't actually want to change them yet and of
> course I
> would never change them to "Jared is the man" but I just
> wanted to see
> if the hyperlinks would change, however, when I tried to run
> this code
> as a macro I got a message that says,
> "Object doesn't support this property or method"
>
> I know I'm probably doing something stupid, but can anyone help
> me know
> what I'm doing wrong?
>



 
Reply With Quote
 
Jared
Guest
Posts: n/a
 
      19th May 2006
Thanks for responding so quickly, I appreciate it, but I changed my
spelling error and now it runs the macro but when I do so nothing
happens. The hyperlinks are still in the same location as they were
before and I really can't tell what the macro did. How can I get the
hyperlinks to change to a new location without manually changing all of
them one by one? Thanks in advance for the help.

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      20th May 2006
replace is case sensitive if you don't specify:

hyp.Address = Replace(hyp.Address, OldStr, NewStr)

could become:
hyp.Address = Replace(expression:=hyp.address, _
Find:=oldstr,, _
Replace:=newstr, _
compare:=vbTextCompare)



Jared wrote:
>
> Thanks for responding so quickly, I appreciate it, but I changed my
> spelling error and now it runs the macro but when I do so nothing
> happens. The hyperlinks are still in the same location as they were
> before and I really can't tell what the macro did. How can I get the
> hyperlinks to change to a new location without manually changing all of
> them one by one? Thanks in advance for the help.


--

Dave Peterson
 
Reply With Quote
 
Jim Cone
Guest
Posts: n/a
 
      20th May 2006
You may want to try the free Excel add-in "List Files".
It will list all files of a specified type from a specified folder.
Download from http://www.realezsites.com/bus/primitivesoftware
--
Jim Cone
San Francisco, USA


"Jared" <(E-Mail Removed)>
wrote in message
I am currently working on a project to hyperlink many bookmarked word
documents to a spreadsheet on Excel 2003. It will have probably a
hundred links. However, All of the word documents are saved on my
computer but eventually they will be saved in a different location but
with the same name. I don't want to do all of the hyperlinks until I
am sure that I will be able to change all of them without doing them
one by one again. I hyperlinked a few and then tried to use this code
to see if the hyperlinks would change anything on it:
Sub FixHiperlinks()
Dim OldStr As String, NewStr As String
OldStr = "D:\Documents and Settings"
NewStr = "Jared is the man"
Dim hyp As Hyperlink
For Each hyp In ActiveSheet.Hyperlinks
hyp.Adress = Replace(hyp.Address, OldStr, NewStr)
Next hyp
End Sub
I know that I don't actually want to change them yet and of course I
would never change them to "Jared is the man" but I just wanted to see
if the hyperlinks would change, however, when I tried to run this code
as a macro I got a message that says,
"Object doesn't support this property or method"
I know I'm probably doing something stupid, but can anyone help me know
what I'm doing wrong?

 
Reply With Quote
 
Jared
Guest
Posts: n/a
 
      22nd May 2006
I get an error message when I replace the line that you gave me with
the new code. Any additonal help would be appreciated.
Thanks,
Jared

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      22nd May 2006
Sorry, I had a typo. Please change the double commas after oldstr to just one.

hyp.Address = Replace(expression:=hyp.address, _
Find:=oldstr, _
Replace:=newstr, _
compare:=vbTextCompare)

Dave Peterson wrote:
>
> replace is case sensitive if you don't specify:
>
> hyp.Address = Replace(hyp.Address, OldStr, NewStr)
>
> could become:
> hyp.Address = Replace(expression:=hyp.address, _
> Find:=oldstr,, _
> Replace:=newstr, _
> compare:=vbTextCompare)
>
> Jared wrote:
> >
> > Thanks for responding so quickly, I appreciate it, but I changed my
> > spelling error and now it runs the macro but when I do so nothing
> > happens. The hyperlinks are still in the same location as they were
> > before and I really can't tell what the macro did. How can I get the
> > hyperlinks to change to a new location without manually changing all of
> > them one by one? Thanks in advance for the help.

>
> --
>
> Dave Peterson


--

Dave Peterson
 
Reply With Quote
 
Jared
Guest
Posts: n/a
 
      23rd May 2006
Hmm, I'm not getting the error message anymore, but it still doesn't
seem to be doing anything, let me see if I'm doing this right. I go to
tools, click on macro, click on Visual Basic Editor, and I click on
Sheet 1 because that's the sheet that has all the hyperlinks that I
will eventually want to change. I put in the following code:
Sub FixHiperlinks()
Dim OldStr As String, NewStr As String
OldStr = "D:\Documents and Settings"
NewStr = "Jared is the man"
Dim hyp As Hyperlink
For Each hyp In ActiveSheet.Hyperlinks
hyp.Address = Replace(expression:=hyp.Address, _
Find:=OldStr, _
Replace:=NewStr, _
compare:=vbTextCompare)
Next hyp
End Sub
And then I go to tools, macro, macros... and then double click on the
macro that was created when I put the code on sheet 1. After that,
nothing really happened that I can see, no error message. When I put
the cursor over text that is hyperlinked, it still says "D:\Documents
and Settings...." I thought that it should have changed to the new
string "Jared is the man". Is the macro doing something that I'm
unaware of or did I do something wrong? What should happen when I run
the macro? Thanks for all of your help.

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      23rd May 2006
I would put it in a general module--not behind the worksheet.

And I would also try changing the link to something that actually exists.

Jared wrote:
>
> Hmm, I'm not getting the error message anymore, but it still doesn't
> seem to be doing anything, let me see if I'm doing this right. I go to
> tools, click on macro, click on Visual Basic Editor, and I click on
> Sheet 1 because that's the sheet that has all the hyperlinks that I
> will eventually want to change. I put in the following code:
> Sub FixHiperlinks()
> Dim OldStr As String, NewStr As String
> OldStr = "D:\Documents and Settings"
> NewStr = "Jared is the man"
> Dim hyp As Hyperlink
> For Each hyp In ActiveSheet.Hyperlinks
> hyp.Address = Replace(expression:=hyp.Address, _
> Find:=OldStr, _
> Replace:=NewStr, _
> compare:=vbTextCompare)
> Next hyp
> End Sub
> And then I go to tools, macro, macros... and then double click on the
> macro that was created when I put the code on sheet 1. After that,
> nothing really happened that I can see, no error message. When I put
> the cursor over text that is hyperlinked, it still says "D:\Documents
> and Settings...." I thought that it should have changed to the new
> string "Jared is the man". Is the macro doing something that I'm
> unaware of or did I do something wrong? What should happen when I run
> the macro? Thanks for all of your help.


--

Dave Peterson
 
Reply With Quote
 
aaron.kempf@gmail.com
Guest
Posts: n/a
 
      23rd May 2006
excel is crap.

the fact that you have to loop through and change formulas in 100
different places?

that is proof that your piece of crap software is obsolete.

if you loved your data you would keep it in a database; and then it
would be easy to update.

 
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
My Hyperlinks don't show color change 1st time I return to slide Charles Knuffke Microsoft Powerpoint 7 5th May 2008 07:32 PM
Global Change of Hyperlinks in Excel Paige Miller Microsoft Excel Discussion 3 26th Mar 2007 01:49 PM
How to change multiple hyperlinks at the same time =?Utf-8?B?UmljaGFyZEluSG91c3Rvbg==?= Microsoft Excel Misc 0 24th Oct 2006 11:42 PM
Can I change several email hyperlinks on a page at the same time? =?Utf-8?B?TWFyaWFubmU=?= Microsoft Frontpage 2 11th Oct 2005 12:23 PM
Why do my hyperlinks in excel change? D Stevens Microsoft Excel Worksheet Functions 0 25th Aug 2003 03:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:21 AM.