AutoCAD VBA Programming: Tools and Techniques

Chapter Twelve: Gotcha's and Tips

Overview

Every programming language has its quirks and special rules. VBA is no exception. Some of the ways it works contrasts with other languages you may already know; this chapter discusses some of the interesting features you will encounter. Subjects covered in this chapter are:

  • Handles data types comparison

  • Uses control keys to maneuver

  • Creates User defined Objects

  • Handles dates

  • Handles Arguments

  • Pointer Arguments

  • Short Circuit Evaluation

  • Access objects on the same level

  • Creates columns and uses multiselect in the listbox control

  • Deals with Variable name shortcuts

  • Deals with the Command line in AutoCAD

If you don't know what some of these things are, do not despair. Some of these are advanced topics and we will endeavor to explain them as we get into the various nuances of the VBA programming environment.

Divergent Data Type Comparison

VBA variables can be declared without assigning a data type. That means it is possible to compare variables that are not of the same basic data type. VBA automatically assigns a default data type of Variant when one it not declared. It is a good idea to get into the habit of assigning the data type whenever you plan to use a variable. This is helpful from a maintenance point of view and for checking divergent data types. Before discussing a technique for avoiding problems with divergent data types comparison, a discussion of how VBA handles data types is in order. The data type of your variable should be determined by the type of...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Handles and Pulls (industrial)
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.