Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Change hyperlink address


Hi all,

I have in my excel document an hyperlink to a word document.
If the word document is moved to another place in the computer, the
hyperlink doesn't work anymore.
If the hyperlink cannot be find, is there a way to change its address
using VBA ? with a window like "open document" where you can search the
file that you want to open?

Many thanks


Sibilia


--
Sibilia
------------------------------------------------------------------------
Sibilia's Profile: http://www.excelforum.com/member.php...o&userid=21363
View this thread: http://www.excelforum.com/showthread...hreadid=392325

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Change hyperlink address

I don't know how you would trap the error when a file has been moved but what
you could do is check all hyperlinks on a sheet when it is activated. If any
are found which wil fail then a prompt will allow you to assign a new file.

Private Sub Worksheet_Activate()
Dim Hpr As Hyperlink
Dim hAdr As String
Dim newLink As Variant
Dim fndAdr As String
Dim nTitle As String

For Each Hpr In Me.Hyperlinks
hAdr = Hpr.Address
fndAdr = Dir(hAdr)
If fndAdr = "" Then
nTitle = "Select file for hyperlink: " & Hpr.Name
newLink = Application.GetOpenFilename(, , nTitle)
If newLink = False Then
Else
Hpr.Address = newLink
End If
End If
Next Hpr
End Sub

This is worksheet event code: right click the sheet tab, select view code
and paste in there.

Hope this helps
Rowan

"Sibilia" wrote:


Hi all,

I have in my excel document an hyperlink to a word document.
If the word document is moved to another place in the computer, the
hyperlink doesn't work anymore.
If the hyperlink cannot be find, is there a way to change its address
using VBA ? with a window like "open document" where you can search the
file that you want to open?

Many thanks


Sibilia


--
Sibilia
------------------------------------------------------------------------
Sibilia's Profile: http://www.excelforum.com/member.php...o&userid=21363
View this thread: http://www.excelforum.com/showthread...hreadid=392325


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
how can change the original address to hyperlink in the Excel? Quirino Excel Discussion (Misc queries) 1 October 17th 08 12:34 AM
My hyperlink address change? hyperlink New Users to Excel 1 June 12th 07 01:58 AM
multiple Hyperlink address change jea3 Excel Discussion (Misc queries) 2 March 22nd 07 07:09 PM
Hyperlink change address LDBlanes Excel Discussion (Misc queries) 1 February 3rd 06 11:30 AM
reading html when hyperlink address not hyperlink text diplayed Kevin Excel Programming 1 December 4th 03 10:13 PM


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