O'Reilly logo

AutoCAD® 2010 and AutoCAD LT® 2010 Bible by Ellen Finkelstein

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 37. Programming with Visual Basic for Applications

Visual Basic for Applications (VBA) is a programming language and environment that is included with many Microsoft applications, such as Word, Excel, PowerPoint, and Access. Since Release 14, VBA has been available with AutoCAD as well. VBA is ideally suited for situations in which you need to work with more than one application at a time. ActiveX, which I discussed in the last chapter in relation to Visual LISP, enables you to access objects in other applications. However, you can also use VBA to program AutoCAD alone. This chapter introduces you to VBA and shows how you can start to use this powerful language to customize AutoCAD.

Note

AutoCAD LT does not support VBA. This entire chapter applies to AutoCAD only.

Visual Basic for Applications is a variation of Visual Basic. Visual Basic is not related to any specific application. Visual Basic code is compiled into an executable file that stands alone, unrelated to any specific document. VBA, on the other hand, is connected to its application and the document in which you created the code. VBA provides a simple way to customize AutoCAD, automate tasks, and create programs from within the application.

VBA in AutoCAD works slightly differently from VBA in most other applications, in that VBA projects are stored ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required