Call VBA by lisp

Call VBA by lisp

Anonymous
Not applicable
672 Views
4 Replies
Message 1 of 5

Call VBA by lisp

Anonymous
Not applicable
Hi,

I have inserted the following lisp instructions in to my acad2007.lsp file
to load a VBA file automatically.

My problem is, every time I open a new DWG file the lisp is trying to reload
the VBA file, is there any way to load the VBA just once when AutoCAD
starts?
Is there any better way to do this in lieu of using lisp?


(princ)
(defun S::STARTUP()
(command "_VBALOAD" "E:/ENGINEERING FOLDER/001-Ready/004-CAD
IMPORTANT/01-CADUTIL.dvb")
)

Thanks in advance.
0 Likes
673 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Hi,

This question gets asked and answered in this NG at least once every couple
of weeks.

The optimum method is not to load the VBA programs till they are needed.
You do this with VL_VBARUN as shown below.

(princ)
(defun RunMyMacro()
(VL_VBARUN" "E:/ENGINEERING FOLDER/001-Ready/004-CAD
IMPORTANT/01-CADUTIL.dvb!MyMacro")
)

VL_VBARUN checks if the program is loaded and if necessary loads it, the
runs the called macro.

--

Laurie Comerford
CADApps
www.cadapps.com.au
www.civil3Dtools.com
--

Laurie Comerford
CADApps
www.cadapps.com.au
www.civil3Dtools.com
"2007-User" wrote in message
news:[email protected]...
Hi,

I have inserted the following lisp instructions in to my acad2007.lsp file
to load a VBA file automatically.

My problem is, every time I open a new DWG file the lisp is trying to reload
the VBA file, is there any way to load the VBA just once when AutoCAD
starts?
Is there any better way to do this in lieu of using lisp?


(princ)
(defun S::STARTUP()
(command "_VBALOAD" "E:/ENGINEERING FOLDER/001-Ready/004-CAD
IMPORTANT/01-CADUTIL.dvb")
)

Thanks in advance.
0 Likes
Message 3 of 5

Ed__Jobe
Mentor
Mentor
Also, check the value of ACADLISPASDOC.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 4 of 5

Anonymous
Not applicable
Thanks Laurie,

So the final format should be like:

(princ)
(defun RunMyMacro()
(VL_VBARUN" "E:/ENGINEERING FOLDER/001-Ready/004-CAD
IMPORTANT/01-CADUTIL.dvb!Starter")
)

The Starter is a module from the same DVB file which has been loaded am I
right? as a matter of fact I have tried this and is not working did I miss
anything?

Thank you.



======================================================================================
"Laurie Comerford" wrote in message
news:[email protected]...
Hi,

This question gets asked and answered in this NG at least once every couple
of weeks.

The optimum method is not to load the VBA programs till they are needed.
You do this with VL_VBARUN as shown below.

(princ)
(defun RunMyMacro()
(VL_VBARUN" "E:/ENGINEERING FOLDER/001-Ready/004-CAD
IMPORTANT/01-CADUTIL.dvb!MyMacro")
)

VL_VBARUN checks if the program is loaded and if necessary loads it, the
runs the called macro.

--

Laurie Comerford
CADApps
www.cadapps.com.au
www.civil3Dtools.com
--

Laurie Comerford
CADApps
www.cadapps.com.au
www.civil3Dtools.com
"2007-User" wrote in message
news:[email protected]...
Hi,

I have inserted the following lisp instructions in to my acad2007.lsp file
to load a VBA file automatically.

My problem is, every time I open a new DWG file the lisp is trying to reload
the VBA file, is there any way to load the VBA just once when AutoCAD
starts?
Is there any better way to do this in lieu of using lisp?


(princ)
(defun S::STARTUP()
(command "_VBALOAD" "E:/ENGINEERING FOLDER/001-Ready/004-CAD
IMPORTANT/01-CADUTIL.dvb")
)

Thanks in advance.
0 Likes
Message 5 of 5

Ed__Jobe
Mentor
Mentor
That still isn't going to prevent it from loading at every drawing opening if you are loading the lisp with every drawing. There are two types of autoloading lisp files, acad.lsp and acaddoc.lsp. acad.lsp loads once when the app starts and acaddoc.lsp loads with every dwg...Except if you've set ACADLSPASDOC to 1. Then everything loads with every dwg.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes