HCBBS Forum (English)
Submit Chemical Projects / Find Solutions
Amplify Your Requirements on a Broader Chemical Platform *Engineering · Technology · Equipment · Solutions*
Submit Request

How to make a cad-vba installer

2007-12-22View Original

Thread Content

I used VBA to make a set of long-distance pipeline measurement software, but I can only use it by copying it to the target folder, then loading the application, and running the macro to load the measurement toolbar. I would like to ask an expert, how can I make VBA automatically load when CAD is running? How can I create an installation package?
Reply #22007-12-22
1. Automatically load VBA projects. There are two different methods to automatically load VBA projects.: 1. When VBA loads, it will look for a project named acad.dvb in AutoCAD. This project file will be automatically loaded and become the default project ; 2. For non-default projects, you can use the VBALOAD command in the startup file acad.lsp to explicitly load the project. Add the following program code to the startup file acad.lsp. When AutoCAD is started, the VBA project MyProject.dvb will be automatically loaded.: (defun S: STARTURP() (command "_VBALOAD" "myproj.dvb")) 2. Execute VBA macros. To execute macros in the project, there are three methods:: 1. Executing VBA macros from the toolbar or drop-down menu Users can execute VBA macros from the AutoCAD toolbar or drop-down menu, which requires modifying the Macro attribute of the toolbar button or drop-down menu item. Macro fanness must be set equal to: -VBRUN Filename.dvb!ProjectName.MacroName where Filename.dvb is the file name of the project, ProjectName is the name of the project, MacroName is the name of the macro to be executed, and VBARUN is an AutoCAD command. 2. Automatically execute VBA macros when AutoCAD starts. Users can automatically execute any macro in the acad.dvb file by using the VBARUN instruction in the AutoCAD startup file acad.lsp to call the macro. For example, if you want to automatically execute a macro named DrawBlot, first create the DrawBlot macro in the acad.dvb file, and then add the following program code to the AutoCAD startup file acad.lsp: (defun S::STARTURP() (command "_-VBARUN" "DrawBlot")) 3. Automatically execute the VBA macro when VBA is loaded. If the name of the macro is AcadStartup, the AcadStartup macro in the acad.dvd file will be automatically executed when VBA starts. This post was last edited by white36 on 2007-12-23 20:36 ]
Reply #32007-12-23
Thank you, there is still something I don’t quite understand (command"_VBALOAD" "myproj.dvb")) Does the storage path of myproj.dvb need to be specified, or does it have to be placed in which directory?
Reply #42007-12-23
  The storage path of dvb is not arbitrary, it should be a path that can be searched by CAD. For example, you can generally copy the dvb file to the installation directory of CAD. If it is any position, please explain it. An example is given below.:   1. The dvb file is in the CAD installation directory (defun S::STARTUP() (command "_VBALOAD" "acad_cg.dvb")) 2. dvb file at any location (defun S::STARTUP() (command "_VBALOAD" "\"C:\\Program Files\\AutoCAD 2004\\Sample\\VBA\\acad_cg.dvb\"")) This post was last edited by white36 on 2007-12-23 23:45 ]

Submit a Project

**Looking for Chemical Technology, Equipment & Solutions?** No Registration Required Broader Platform Exposure | Global Chemical Service Provider Connections

Submit Request — Free Consultation

Disclaimer

This is an automated machine translation of the original thread. Some technical terms may have inaccuracies; the original text shall prevail. Click "View Original" at the top right to access the source page, which supports IP-based automatic real-time language translation. Please watch out for contact details and sales inducements to prevent fraud. All content and translations are for reference only, representing solely the poster's personal views. For enquiries, email service@hcbbs.com.