You can use:
If Not Me.DesignMode Then ... End If
Another solution we used was a small function that can be used globally:
Public Function IsRuntime() as Boolean On Error Goto NotRuntime Debug.Print(1 / 0) IsRuntime = True Exit Function NotRuntime: IsRuntime = False End If
I donβt know if it is syntactically formed, but the idea should be clear: Only in the IDE is the debug command called.
source share