Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how can change the original address to hyperlink in the Excel? | Excel Discussion (Misc queries) | |||
My hyperlink address change? | New Users to Excel | |||
multiple Hyperlink address change | Excel Discussion (Misc queries) | |||
Hyperlink change address | Excel Discussion (Misc queries) | |||
reading html when hyperlink address not hyperlink text diplayed | Excel Programming |