Help with on error msg box

Teresa Allen

New member
Local time
Today, 22:30
Joined
Mar 5, 2003
Messages
8
I have this code witten and workes correctly but I need an error msg box that pops up if the Hyperlink file is not found can anyone help me with this? I'm not sure if it should be on error or an if statement?

Private Sub Document_Number_Text__Box_DblClick(Cancel As Integer)
Application.FollowHyperlink "\\NTSRVCA\ENG\DOCSYS\ELK_DWGS\" & Document_Number_Text__Box
End Sub

Thanks so much for your help
 
What is the error number that occurs when the file is not found?
 
Runtime error '490'

Thanks
 
I'm thinking this might work - give it a try:

Private Sub Document_Number_Text__Box_DblClick(Cancel As Integer)
On Error go to HandleError


Application.FollowHyperlink "\\NTSRVCA\ENG\DOCSYS\ELK_DWGS\" & Document_Number_Text__Box


HandleError_Exit:
exit sub


HandleError:
select case err.number

case 490
msgbox "The File is Not Found - Do something else",vbinformation, "File Not Found"

cancel = true
resume handleerror_exit

case else
msgbox "Error Number: " & err.number & "Description: " & err.description
resume handle error_exit
end select



End Sub
 

Users who are viewing this thread

Back
Top Bottom