TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Humbertogo on March 07, 2006, 05:50:27 AM
-
When I try to use it using the vl-vbaload, it never loads:
Command: (vl-vbaload "test.dvb")'VLIDE ; error: Automation Error. Problem
in
loading DVB file
Is there more to using this function than what is in the help file?
thanks
-
You might try here first (http://www.theswamp.org/index.php?action=search)
I know this topic has been gone over in various incarnations and different applications in several threads.
-
The "usual" cause for that message is the file not being found on the ACAD path.
Perhaps try something like this ;
(if (setq tmp (findfile "test.dvb"))
(vl-vbaload tmp)
;; else
(prompt "\n Unable to find file")
)
-
(if (vl-catch-all-error-p
(vl-catch-all-apply
'vl-vbaload
(list
(findfile "test.dvb")
) ;_ list
) ;_ vl-catch-all-apply
) ;_ vl-catch-all-error-p
(vl-vbaload
(list
(getfiled "Select a VBA File \"test.dvb\"" "" "dvb" 8)
) ;_ list
) ;_ vl-vbaload
)
-
it seen that i can not load the function from the acaddoc.lsp
when i load it from the vlisp editor or from the appload command the function
is working OK
i use
;(load "test")
(vl-load-all "test.lsp")
but isn't load
-
I think the best way is load your application through _appload window. I prefer do not change acaddoc.lsp and acad.lsp files.
-
My 2¢:
(vl-vbarun "MyVba.dvb!MyModul.MySub")
Load and start in one step...
There are some known problems if the dvb is loaded on startup...
-
Jürg
(vl-vbarun "MyVba.dvb!MyModul.MySub")
will give "Execution Error" that what i try to remove
acc ADN
;;; Issue While executing a VBA macro from LISP, a statement that says "Execution Error"
;;; is echoed on the command line.. My macro seems to work correctly, however, why
;;; is the statement always there?
;;; The best way to run a VBA macro from LISP is to use the automation interface and
;;; not the command function. Your AutoLISP code should look like the following:
-
Is the dvb in a folder of the acad environment?
Or
Probably you've an error in the vba code... can you compile the project?
-
The dvb file is finding in the support files path
my vba project have not error
-
I'm finished with my knowledge... :-(
You may post the dvb to check this behaviour...
-
You can try putting (arxload "acadvba.arx") before the line where you load your dvb. It's not likely to help, but it's certainly worth a try.
Jurg is correct though. We need more pieces of the puzzle before we can offer anything really helpful.
-
This is the code what i use.
I copy the dvb file in to start in Folder and it working well (DWGPREFIX )
But when i copy the file in another folder in the support file search path
i get the err
Command: (RunVBAMacro "MsgBoxHello.dvb" "MyTestProject.MyModule.TestMacro")
; error: Automation Error. Problem in loading DVB file
(defun RunVBAMacro (dvbfilename vbaMacro / acadApplication dvbfile)
;; Load ActiveX
(vl-load-com)
(setq acadApplication (vlax-get-acad-object))
(setq dvbfile (findfile dvbfilename))
(if dvbfile
(progn (vla-LoadDVB acadApplication dvbfile)
(vla-RunMacro acadApplication vbaMacro)
);progn
)
(if acadApplication
(if (null (vlax-object-released-p acadApplication))
(progn (vlax-release-object acadApplication)
(setq acadApplication nil)
)
)
)
(princ)
)
-
That's all what you have to use:
(defun RunVBAMacro (dvbfilename vbaMacro / dvbfile)
(vl-load-com)
(if (setq dvbfile (findfile dvbfilename))
(vl-vbarun (strcat dvbfile "!" vbaMacro))
)
(princ)
)
Call:
(RunVBAMacro "MsgBoxHello.dvb" "MyModule.TestMacro")
Note:
Don't use the project name...
And
How about the rights in this folder?
-
The code is only working when i copy it in to the acaddoc.lsp..
but not when i load it as file (RunVBAMacro.lsp).!!!
-
Hmmm...
First load:
(load "RunVBAMacro.lsp")
then run:
(RunVBAMacro "MsgBoxHello.dvb" "MyModule.TestMacro")
should work...
-
That exact what i do.. :grazy:
-
thanks guys
it's something wrong whit me system i just try in another an working fine :-D
-
Otherwise I'm at my wits' end... :roll: