Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File not found calling Shell("..\.....\....)

Status
Not open for further replies.

HydraNL

Technical User
May 9, 2005
74
NL
Hi,

Have a little question.

I'm calling a Shell: eg.
Private Sub Command1_Click()
Shell("C:\Uninstall.exe"). Works fine.
End Sub

but when the file is not available it just stops. So I tried it with On Error GoTo Err
Err: msg "File not found"
Doesn't work also.

Anyone sees what I'm doing wrong?
 
1. Do not use Err for the label. It is the error object.
2. Use MsgBox instead of msg. What is msg?

This is the simplest example:

private sub MySub

on error goto MethodEror

Some code

MethodError:
if err.number <> 0 then
msgbox err.number & " in MySub. " & vbcr & Err.Description
end if
end sub
 
Thnx vladk. It works fine now.

By the way: "msg" was a shortcut for MsgBox
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top