Dave,
Thanks for the code.
Norman,
Thanks for the explanation.
Jack.
"Norman Jones" schreef in bericht
...
Hi Dave,
A good idea!
I had not thought of using the procedure's name string (as required by the
Run method) and thus avoiding the compile error.
Thank you!
---
Regards,
Norman
"Dave Peterson" wrote in message
...
I think Ron forgot to add to change the Call to Application.Run <bg.
This "worked" for me if I spelled "doesitexist" as "NoItDoesNot".
Option Explicit
Sub aaaa()
On Error Resume Next
Application.Run ThisWorkbook.Name & "!doesitexist"
If Err.Number < 0 Then
Beep
Err.Clear
End If
On Error GoTo 0
End Sub
Sub doesitexist()
MsgBox "yes"
End Sub
Ron Rosenfeld wrote:
On Sun, 11 Sep 2005 10:51:55 +0200, "Jack Sons"
wrote:
Hi all,
In the code below ABCD can be executed if it is a subroutine - sub
ABCD() -
in a module elsewhere in the same project. If ABCD is a not an existing
sub
the execution will halt, an error message wil appear on screen and a
sound
wil be produced. Fore some reason I want to hear that sound but I don't
want
the the program to halt. If possible it would be nice if also the
message
box does not appear, but I need to hear the error sound. To my regret I
did
not succeed with the code below.
Anybody who knows what code is needed to let the program continue when
execution comes to the line with the undefined ABCD but do let the
error
message sound hear?
Jack Sons
The Netherlands
Sub ingnoreABCD()
........... ' here the program already did some things
Application.DisplayAlerts = False
ABCD
Application.DisplayAlerts = True
.............. ' here I want to do what the program should do
End Sub
Take a look at the On Error statement and also the Beep statement.
--ron
--
Dave Peterson
|