I use this routine (don't remember who to credit it to - doh!):
Public Function IsDebugMode(Optional bSetMode As Boolean = False) As Boolean
Static DebugMode As Boolean
DebugMode = bSetMode
If Not DebugMode Then Debug.Assert IsDebugMode(True)
IsDebugMode = DebugMode
End Function
I've seen others that check for the name of the program, use debug.print 1/0 (divide by zero) and trap the error, but this one will work properly even with trapping all errors mode selected (the divide by zero won't) in the IDE.
"I think we're all Bozos on this bus!" - Firesign Theatre
I tend to use the following. Not sure why you would want to but you can simulate debug mode when running the exe (C:\Project1.exe -DEBUG)
In the project/properties/make set a command line argument say -DEBUG
Code:
'In a code module:-
Public IsDebugMode As Boolean
'In main or startup form:-
IsDebugMode = IIf(InStr(Command, "-DEBUG") > 0, True, False)
'As required:-
If IsDebugMode Then MsgBox "debug.mode"
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.