[Search tip detail and code files using keywords, tip number, author name, etc ]
    For tip to function correctly, you must ensure that the downloaded file name matches the file name
    displayed in the Rename File To field. Please rename downloaded files when necessary.
Master VBA dialog boxes
Tip# LIP1003 By Barry Bowen On 01-Oct-2003
Rated By 1 users Downloaded : 536
Categories : VBA Code Modules
Software type : AutoCAD
Rename File To : line1.dvb.
Line1.dvb illustrates how to build dialog boxes in VBA.

One time-saving feature of VBA (Visual BASIC for Applications) is its ability to create forms and dialog boxes to gather data for your programs. Using AutoCAD, we'll look at how to code VBA controls for user-defined forms or dialog boxes by focusing on a specific control in each of the next few installments. This is a fast-track approach. Many VBA reference books are available, so we'll skip the basic details and get right to implementing a VBA project with a user interface. Although this column is designed as a starting point for newcomers to VBA, you should at least be familiar with the VBA IDE (integrated development environment) components for placing controls on a form and changing their properties.

To open AutoCAD's VBA IDE, select Tools | Macro | Visual Basic Editor. In the VB editor, select Insert | User Form to insert a blank form. Rename the form caption in the Properties window to Line1 Program.

This month we'll create a dialog box for input to create a line. We'll use the TextBox control to obtain the line's distance and angle. A TextBox control lets you edit or enter a single line of text. Figure 1 shows the size and placement of the controls.



Average Rating:

User comments