Rahul
Rahul

Reputation: 1110

How to run a .dvb file on a .dwg file load using Visual Basic in Autocad 2012?

I am trying to load and run a .dvb file on every drawing file load in Autocad2012. I am trying to automate this thing like if anybody opens a .dwg file VBA will run automatically.

Upvotes: 0

Views: 3686

Answers (2)

Rahul
Rahul

Reputation: 1110

Ok I got it. It contains two step 1.) Create a Autolisp(.lsp) file in the folder in which your .DWG file is placed with the name "acaddoc.lsp".

2.) write the following command. (defun S::STARTUP() (command "_-vbarun" "D:\Test File\acad.dvb!Module1.AcadStartup"). )

Upvotes: 1

Trae Moore
Trae Moore

Reputation: 1787

You should stop using vba. It's no longer supported, since 2010.

You can load a dvb and run it via lisp Using the command vbaload.

(Vbaload "path")
(Command "yourCommandName")

If a VBA application is already loaded, and you run Vbaload, you get an error.

You will need to add your lisp file in the startup suite using the appload command

Or

What you will need to do is, rewrite your dvb in c# or vb.net and have AutoCAD run your .net method when it opens by passing this in a lisp

(Command "netload" "PathToThe.dll")
(Command "theCommandYouSpecify")

Upvotes: 1

Related Questions