AutoCAD VBA Programming: Tools and Techniques

The primary feature of VB is that it is capable of working with other programs that support automation inside of Windows. Some of the programs that support automation include the Microsoft Office 97 programs Word, Excel, and Access. This chapter demonstrates the basic strategies of interfacing AutoCAD VBA with these tools. In particular, we will pay attention to interfacing AutoCAD VBA with Microsoft Excel. This chapter is merely an introduction to using automation tools with these other packages. There are other books available that deal with the interfaces into the packages in much more detail. This chapter continues with an exploration of the techniques involved in building links between AutoCAD and external data systems using extended data (Xdata). We also cover the Dictionary and Xrecord objects in how they can be used in relation with external interfaces.
Every program that supports ActiveX automation has an object tree that is similar to the AutoCAD object tree. The difference is that the tree for the other application will be specific to that application just as the AutoCAD object library is dedicated to AutoCAD.
The object model in the other applications will follow the basic strategy (figure 7.1) of having the application at the root. There will be various properties, methods, and events associated with the application that may interest you, but normally your first step is into the documents. Inside the collection of documents will be the one document the application wants to access.
Each...