PDA

View Full Version : VBA run hangs AutoCAD


kyheulon
05-09-2004, 06:19 PM
Everyone,

I'm currently trying to load and run a VBA with the below command in our acaddoc.lsp. When AutoCAD is launched and a new drawing "Drawing1" is opened the VBA is loaded and runs fine. Then when a drawing is opened the loading of the VBA hangs AutoCAD. The last line in the command window is "-vbarun" and nothing else happens.

Here is what I have been able to figure out... When NOT loading the VBA and everything works fine, I launch AutoCAD and get the blank "Drawing1" drawing, then I open an existing drawing, AutoCAD closes the "Drawing1" (because nothing was done to it) and opens the desired drawing. When loading the VBA in the acaddoc.lsp, I launch AutoCAD and get the black "Drawing1" drawing, then I open an existing drawing, AutoCAD closes the "Drawing1" and opens the drawing desired and hangs. If I launch AutoCAD and manualy close the "Drawing1" drawing and then open an existing drawing it opens and runs the VBA.

If anyone has any ideas please respond.

Here is the command that loads and runs the VBA. And the VBA "Tester" only consists of one MsgBox line letting me know it was loaded and ran.

(command "-vbarun" "Tester.dvb!Tester")

Thanks,

YosSa
06-09-2004, 08:05 AM
Please attach the dvd file !!!

Eddie
06-09-2004, 12:13 PM
8) Or post your code...it sounds like the code is doing something to cause this issue.

kyheulon
07-09-2004, 11:57 AM
I don't think the vba code has anything to do with it. but here it is anyway.... Please re-read the original post and try to follow when the vbrun hangs AutoCAD.



Public Sub Tester()

MsgBox "VBA Loaded and Ran...", , "VBA Tester"

End Sub

TCARPENTER
07-09-2004, 07:11 PM
kyheulon,

I'm wondering if you're actually getting an error message you may not be seeing.

The line: (command "-vbarun" "Tester.dvb!Tester")

won't load the "Tester.dvb" file, it will only execute it, if you don't already, add this line in your acaddoc.lsp file and see if your problem goes away:

(command "-vbaload" "Tester.dvb")

There are a couple of other things that can go wrong, if your drawing has xrefs it can't find, or you have some drawing entities making use of Rtext and reactors you could be bumping heads with VBA, in which case you'll want to make use of the IsQuiescent property.

HTH
Todd