Creating Opening and Saving Projects

To extract, embed, create, save, load, and unload VBA projects, open the VBA Manager dialog box, shown in Figure 1-14. To open it, either type VBAMAN at the AutoCAD command prompt or choose Tools > Macros > VBA Manager.

You must explicitly load all .dvb projects. AutoCAD loads embedded projects automatically when the drawing containing them is opened, depending upon how you configure AutoCAD's security options. Clicking New creates a new project in the VBAIDE that you can access by clicking the Visual Basic Editor button. To load an existing project, click the Load button. The Open VBA Project dialog box in Figure 1-15 appears, letting you choose the project to load.

Tip Embedding VBA macros within drawings is fine for drawings that remain within your organization. Avoid embedding macros when you'll deliver the drawings to outside users or customers as it imposes a security risk on their part to trust your macros in their environment.

This dialog box is similar to the standard File Open dialog box in Windows. Similar to creating a new project, when you choose the .dvb project you want, click the Visual Basic Editor button to start working on your project.

Figure 1-14. The VBA Manager dialog box
Figure 1-15. The Open VBA Project dialog box

There are two other ways to create and load DVB project files:

• Type VBAIDE at the AutoCAD command prompt or press Alt+F11 to open or create a DVB project file.

• Type VBALOAD at the AutoCAD command prompt to open the Open VBA Project dialog box so you can choose a project to load.

To save your project, choose File > Save or press Ctrl+S. If you have not previously saved your project, the standard Save As dialog box appears, as shown in Figure 1-16.

JLJx]

Save in:

Save in:

C3i2ndDrafts

S] Chapter 22 - Illustrative VBA t

S]CreateElock,dvb kj] CreateTableBOM.dvb m] LayerReporter.dvb kj] ListBlockRefs.dvb

™]PnntBOM.dvb

^Appendix A - Object 5unnnnary ¡^Appendix B - Constants Reference

Appendix C - System Variables ^ Appendix D - Complete Cross Reference Chapter 20 - Creating Tables,dvb

<1 1 M

File name:

[Project, dvb

Save

1 Project (".dvb)

d

Cancel

Figure 1-16. Save As dialog box

Unlike in Visual Basic, you don't need to save each project module separately. AutoCAD saves them all in a .dvb file. However, as the next section illustrates, you can export each module to a separate file.

Tip Avoid saving your custom program files under the AutoCAD installation folder tree. Instead, create a separate folder tree for them. This prevents AutoCAD installations and updates from affecting your program files.

Was this article helpful?

0 -1

Responses

  • Ninfa
    How to get name dvb active in autocad?
    5 months ago

Post a comment