FollowHyperlink - Error 490

D

Douglas J. Steele

Did you have a question, Bob?

If you've got code that's raising that error, what's the code?
 
B

Bob Barnes

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
 
D

Douglas J. Steele

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)
 
B

Bob Barnes

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top