Use VBA Constants and Enums

VBA contains many internal constants and enumerated types to provide consistency and more readable code. Some programmers like to bypass these internal types and use the numeric equivalents. The most common of these practices is to use 0 and 1 for the Boolean FALSE and TRUE.

You might also be tempted to do (or run into code that does) something like this:


If MsgBox("Do you want to continue", 4) = 6 Then
...
Else
...
End If

Instead of this:


If MsgBox("Do you want to continue", vbYesNo) = vbYes Then
...
Else
...
End If

Just don’t do it.

EnvisionCAD

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.

Tags:

Leave a Reply

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