Jump to content

Recommended Posts

Posted

HOW CAN I LOAD A .dvb FILE BY VBALOAD AND THEN RUN IT BY VBARUN ALL BY ONE LISP?

Posted

it doesn't work because i must load .dvb file before run it

thanks for your help

Posted

>> (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")

 

 

 

 

 

 

Posted

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.

Posted
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]

Posted

Thanks Alot Guys I Make Lisp In Attachment And It Work Very Good I USE YOUR HELP IN IT THANKS AGAIN

VB.LSP

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...