AutoCAD VBA

VBA IDE Components (Quick Tour of the IDE) (AutoCAD VBA) Part 1

In this topic, I’ll take you on a quick tour of all the IDE components and some of the features they offer—that way you’ll get an idea about how everything fits together. The VBA IDE contains a collection of powerful commands and tools that you’ll find extremely convenient and helpful for creating VBA macros and […]

VBA IDE Components (Quick Tour of the IDE) (AutoCAD VBA) Part 2

General Options The options on the General tab of the Options dialog box, shown in Figure 3.5, help you control the grid that is displayed as dots on the UserForm. You can make the grid dots visible or invisible, or adjust the spacing between them. You can also choose whether or not to display ToolTips, […]

VBA IDE Components (Quick Tour of the IDE) (AutoCAD VBA) Part 3

Debug Toolbar Buttons The Debug toolbar (Figure 3.8) provides fast access to the commands available from the Debug menu, as well as a few other commands. You’ll find this toolbar extremely useful when your code doesn’t work as you expected it to. Notice that the Toggle Breakpoint button exists in both the Edit and Debug […]

Printing UserForms (Quick Tour of the IDE) (AutoCAD VBA)

The IDE’s Print command uses the default printer that has been designated in the operating system’s Control Panel. To print the code from the module currently active in the Visual Basic Editor, follow these steps: 1. From the IDE, select a module and choose File ^ Print. This displays the Print – ACADProject dialog box, […]

Overview of the Code Commands (Quick Tour of the IDE) (AutoCAD VBA)

This section takes a quick look at some of the coding commands available from the Edit, Debug, and Run menus. You’ll find that many of these commands are initially hidden. To make them available, a Code window must be open. Let’s continue with the three-text-boxes project. Double-click anywhere on UserForm1 to open the Code window […]

Getting Help (Quick Tour of the IDE) (AutoCAD VBA)

The online Help facility is another indispensable feature of the IDE—not only does it offer you a helpful explanation about many topics, but it often gives some sample code, too. You can copy this sample code and run it from the IDE. While you are building your expertise in Visual Basic, it is often useful […]

How Code Instructs the Computer (VBA Programming Concepts) (AutoCAD VBA)

This topic explains the coding concepts and terminology of VBA. If you have previous experience in writing code, some of the material will be familiar to you, so you may want to make your first read a quick one. But I’m sure you’ll find it a continuing handy reference as you gain experience. And for […]

All about Variables (VBA Programming Concepts) (AutoCAD VBA)

A variable is a name that’s used to refer to a location in memory containing an item of data. Items of data can be anything from strings to whole numbers, from currency to decimal fractions. Figure 4.1 shows the Help window containing all types of data available and their memory requirements. Figure 4.1 The Help […]

Handling Arrays of Variables (VBA Programming Concepts) (AutoCAD VBA)

Quite often your VBA code will contain lots of data items that all have the same type. An efficient way to handle these items is to declare a single entity called an array that allows you to refer to any item using the array’s name and an index that identifies the item’s position in the […]

All About Constants (VBA Programming Concepts) (AutoCAD VBA)

A constant is the term given to a value that remains unchanged as long as the application is running. The values of some constants (such as pi) may never change. Others (such as TaxRates) may change from time to time. Such values should all be declared as constants and given names that can be used […]