How to find out whether you are in IDE or compiled code

Applies To

OS:
VB:
NT, 9x, 2000
5, 6

Below is a quicky function that lets you determine at runtime whether the code is compiled or you are running in the IDE.


Private Function IsTheCodeCompiled() As Boolean
    On Error Resume Next

    Debug.Print 1 / 0
    IsTheCodeCompiled = IIf(Err, False, True)

End Function