VBA Tip: Debug

Written by Rod Wing.


VBA DebugThe Debug function is useful for setting conditional break expressions and for printing informational messages during execution of the application. The Debug statements are only executed while in Debug mode. The statements are ignored during normal execution of the program.

The Debug function has the following two methods:

  • Assert – Suspends execution of the program if the supplied Boolean expression evaluates to False
' Breaks if  the current ElementEnumerator element
' is not a graphical element
Debug.Assert ee.Current.IsGraphical
  • Print – Displays the supplied String expression to the Immediate window.
Debug.Print "Level name = " & myLevel.Name

Last Month’s Tips:

1   Screenshot   1    2

MicroStation: Apply                InRoads: Survey-                    AutoCAD Civil 3D 2014:          VBA: Call Stack
Element Template to…          Filtering Fieldbook Co…        Extract Corridor Solid      


Since 1996, EnvisionCAD has been a nationally recognized leader in the configuration, customization, implementation, training & support for CAD software solutions. Our individualized approach has benefited private engineering firms and government agencies alike. Basic or advanced, we can help you get the most from your CAD technology.


Leave a Reply

Your email address will not be published. Required fields are marked *