FollowHyperlink - Error 490

  • Thread starter Thread starter Bob Barnes
  • Start date Start date
Did you have a question, Bob?

If you've got code that's raising that error, what's the code?
 
Doug - It's at another lient, but it's like the code below which works all
but that one time, where error 490 said it was unable to open the file...but
it opened fine manually.

Here's the code..where M, N & O are strings, Resp is a Byte
N = "C:\BobDev\M_OpTime.xls"
M = "The File " & N & vbCrLf
M = M & "Is Now Ready." & vbCrLf & vbCrLf
M = M & " Open " & Chr(34) & N & Chr(34) & " ??"
O = "Open " & Chr(34) & N & Chr(34) & " ??"
Resp = MsgBox(M, vbQuestion + vbYesNo + 0, O)
If Resp = vbYes Then Application.FollowHyperlink N, , True

TIA - Bob
 
You positive the file name is correct?

N = "C:\BobDev\M_OpTime.xls"
M = "The File " & N & vbCrLf
M = M & "Is Now Ready." & vbCrLf & vbCrLf
M = M & " Open " & Chr(34) & N & Chr(34) & " ??"
O = "Open " & Chr(34) & N & Chr(34) & " ??"
Resp = MsgBox(M, vbQuestion + vbYesNo + 0, O)
If Resp = vbYes Then
If Len(Dir(N)) > 0 Then
Application.FollowHyperlink N, , True
Else
MsgBox "Ooops. My mistake. " & N & " doesn't exist."
End If
End If

If that doesn't work, try

Application.FollowHyperlink N, , NewWindow:=True

(note that's colon equal sign, not just equal sign)
 
Doug - I'll be back at that Client Friday or Sunday. I could have misspelled
the Filename, but I thought it was OK. I like you adding checking for the
File..nice code to have..which I'll start using. I usually check for the
file's existence before running the code..

Will DEFINITELY try..
Application.FollowHyperlink N, , NewWindow:=True

...where File is coded as a string before seeing this code.
If Dir(File) = "" Then
M = "The File " & File & vbCrLf
M = M & "Is Not On Your PC." & vbCrLf & vbCrLf
M = M & "You Need To Load It To Run" & vbCrLf
M = M & "The " & cboMgmt & " Report.": MsgBox M, , "": Exit Sub
End If

Thank you - Bob
 
Back
Top