;; ================================================= ;; AUTOVBALOAD.LSP Copyright 2000 Tony Tanzillo ;; ;; (AutoVBALoad ) ;; ;; Defines an AutoCAD command that loads a ;; specified DVB file, and executes a macro ;; defined in the DVB file. ;; ;; is a string that names ;; the AutoCAD command to be defined. ;; ;; **** DO NOT include a "C:" prefix on the ;; name of the command *** ;; ;; (string) is the filename and the ;; extension of the vba project file containing ;; the specified procedure. A path is optional, ;; and if not supplied, the AutoCAD library path ;; is searched for the specified file. The ".DVB" ;; file extension is required. If the specified ;; project is already loaded, it is not reloaded ;; each time the command is issued. ;; ;; (a string) is the name of the VBA macro ;; that is to be run. This parameter can be nil, in ;; which case, the macro name must be the same as ;; the command name. A prefix of "ThisDrawing." is ;; the default. You can specify a macro in another ;; module using the "ModuleName.MacroName" syntax. ;; ;; Examples: ;; ;; Defines a command called "TEST", which ;; loads a DVB file called "MyProject.dvb", ;; and executes the macro "ThisDrawing!MySub": ;; ;; (AutoVBALoad "TEST" "MyProject.dvb" "MySub") ;; ;; Defines a command named FOO which loads ;; "Foobar.dvb" and exeuctes the macro named ;; "Foo()": ;; ;; (AutoVBALoad "FOO" "Foobar.dvb" nil) ;; ;; Defines a command named UPDATE that loads ;; the project file "MyProject.dvb" and runs ;; the macro "bar" which is contained in the ;; module named "Foo": ;; ;; (AutoVBALoad "UPDATE" "MyProject.dvb" "Foo.Bar") ;; (defun AutoVBALoad (cmdname project macro) (eval (list 'defun (read (strcat "C:" cmdname)) nil (list 'vl-vbarun (strcat project "!" (if macro macro cmdname) ) ) (princ) ) ) )