MR MAN Posted October 19, 2008 Posted October 19, 2008 HOW CAN I LOAD A .dvb FILE BY VBALOAD AND THEN RUN IT BY VBARUN ALL BY ONE LISP? Quote
rkmcswain Posted October 19, 2008 Posted October 19, 2008 [color=blue][font="Courier New"] (vl-vbarun "filename.dvb!module.sub") [/font][/color] See also: http://www.caddzone.com/autovbaload.lsp Quote
MR MAN Posted October 20, 2008 Author Posted October 20, 2008 it doesn't work because i must load .dvb file before run it thanks for your help Quote
rocheey Posted October 20, 2008 Posted October 20, 2008 >> (vl-vbarun "filename.dvb!module.sub")) >>it doesn't work because i must load .dvb file before run it It just needs a litle tweaking, thats all. Remove the second parentheses from the end [from "))" to ")"], and put the full drive\pathname in there, using *double* slashes. For example: You have a VBA program called "MyProgram.dvb", located in the drive\folder named "Y:\MyFolder\" The VBA Program wants to run a subroutine named "MySub", located in the code module "MyModule" Format the load command like this: (vl-vbarun "Y:\\MyFolder\\MyProgram.dvb!MyModule.MySub") Quote
ASMI Posted October 20, 2008 Posted October 20, 2008 You can to use this: (defun Load_And_Run_VBA(File Procedure / cFile) (vl-load-com) (defun Get_VBP_List(/ cPr cPat VBPrj pQnt pCnt prLst) (setq VBPrj(vlax-get (vla-get-VBE (vlax-get-acad-object)) 'VBProjects) pQnt(vla-get-Count VBPrj) pCnt 1) (repeat pQnt (setq cPr(vla-Item VBPrj pCnt)) (if(vl-catch-all-error-p (setq cPat(vl-catch-all-apply 'vlax-get(list cPr 'FileName)))) (setq prLst(cons "*Invalid Project*" prLst)) (setq prLst(cons cPat prLst)) ); end if (setq pCnt(1+ pCnt)) ); end repeat prLst ); end of Get_VBP_List (if(setq cFile(findfile File)) (progn (if(not(member cFile(Get_VBP_List))) (vl-vbaload cFile) ); end if (vl-vbarun Procedure) ); end progn (princ (strcat "\n<!> Can't to find VBA Project: '" File "' <!> ")) ); end if (princ) ); end of Load_And_Run_VBA For example: (Load_And_Run_VBA "C:\\My VBA Routines\\My program.dvb" "MyProcedure") This code check up list of loaded *.dvb files and loads a VBA programs one time only but runs every time. Quote
rkmcswain Posted October 20, 2008 Posted October 20, 2008 it doesn't work because i must load .dvb file before run it Wrong. That example will load the DVB file and run the specified macro. If the DVB is not located in your support file search path, then you will need to specify the path, like this: [color=blue][font="Courier New"] (vl-vbarun "\\\\server\\share\\dir\\filename.dvb!module.sub") [/font][/color] Quote
MR MAN Posted October 20, 2008 Author Posted October 20, 2008 Thanks Alot Guys I Make Lisp In Attachment And It Work Very Good I USE YOUR HELP IN IT THANKS AGAIN VB.LSP Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.