Run VBA project from commadline
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Run VBA project from commadline

 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA
Author Message
kb
Guest





Posted: Fri Apr 01, 2005 10:23 pm    Post subject: Run VBA project from commadline Reply with quote

Hi,

I have a VBA application that is automatically loaded in Autocad within the acad2005.lsp file. I can then type the key would in the command line to lauch the application and run it.

(if (not (= (substr (ver) 1 11) "Visual LISP")) (load "acad2005doc.lsp"))

;; Silent load.
(princ)

(defun C:Run_Update()
(command"_-vbarun" "D:\\My_APPlication1\\MainProject.dvb!ShowMainForm")

(princ)
)

But now I have built another VBA application that I would like to auto load, and run in the same manner. So the user would type in Run_Update_new in the command line and it would start a different VBA applciation.

How do I can another app to do this? I tried the below code, which didn't work:

(if (not (= (substr (ver) 1 11) "Visual LISP")) (load "acad2005doc.lsp"))

;; Silent load.
(princ)

(defun C:Run_Update()
(command"_-vbarun" "D:\\My_APPlication1\\MainProject.dvb!ShowMainForm")

(defun C:Run_Update_new()
(command"_-vbarun" "D:\\My_APPlication2\\MainProject2.dvb!ShowMainForm2")

(princ)
)

Ultimately, i would like the to add a custom botton on the users machine so they would just push a button and not have to type anything in.

Any ideas?

Thanks,
kb

Back to top
Dave
Guest





Posted: Sat Apr 02, 2005 6:42 am    Post subject: Re: Run VBA project from commadline Reply with quote

You can make a lisp file referencing your macros. The ones below call a dvb
file and the dvb file in turn, calls a classmodule in an ActiveX dll. Yours
could probably just call your rutine macro name in your dvb and it will run.
This lisp is loaded int he startup suite and is created on the fly with the
installer.

Hope it helps and have a good weekend.


;smd
(defun c:sd() (command "-vbarun" "D:/Program
Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.start_demo"))
(princ)
(defun c:sset() (command "-vbarun" "D:/Program
Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.show_settings")
)
(princ)
(defun c:vo() (command "-vbarun" "D:/Program
Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.showonlyselecte
d"))
(princ)
(defun c:ho() (command "-vbarun" "D:/Program
Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.hideselectedent
ities"))
(princ)
(defun c:ao() (command "-vbarun" "D:/Program
Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.showallentities
"))
(princ)
(defun c:33() (command "-vbarun" "D:/Program
Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.update"))
(princ)
(defun c:edxf() (command "-vbarun" "D:/Program
Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.ExportDXF"))
(princ)
(defun c:edwg() (command "-vbarun" "D:/Program
Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.ExportDWG"))
(princ)
(defun c:c2c() (command "-vbarun" "D:/Program
Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.C2C"))
(princ)
(defun c:slx() (command "-vbarun" "D:/Program
Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.ExplodeAssembly
"))
(princ)
(defun c:sm() (command "-vbarun" "D:/Program
Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.Move"))
(princ)
(defun c:sco() (command "-vbarun" "D:/Program
Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.Copy"))
(princ)
(defun c:sg() (command "-vbarun" "D:/Program
Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.Group"))
(princ)
(defun c:slmat() (command "-vbarun" "D:/Program
Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.Material"))
(princ)
(defun c:ATP() (command "-vbarun" "D:/Program
Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.ATP"))
(princ)
(defun c:SLSEC() (command "-vbarun" "D:/Program
Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.Section"))
(princ)
(defun c:SLV() (command "-vbarun" "D:/Program
Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.MakeView"))
(princ)
(defun c:SLF() (command "-vbarun" "D:/Program
Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.FreezeSections"
))
(princ)
(defun c:SLT() (command "-vbarun" "D:/Program
Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.UNFreezeSection
s"))
(princ)
;/smd
--
David Wishengrad
President & CTO
MillLister, Inc.
Software for BOM, measuring, stretching, feature recognition, and
controlling visibility of
multiple 3D solids.
Http://Construction3D.com
Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB