Startup in acad2000doc.lsp

ptti

Usenet Archive
Joined
Feb 3, 2004
Messages
8
Reaction score
0
Hello Everyone! I searched this forum and found that to have vba code to be ran whenever AutoCAD is launched, to place it in the acad2000doc.lsp file. So I placed the following code in this file:

(defun S::STARTUP
(command "._vbastmt" "startup")
)

Whenever I open up some files it works ok and other files it gives me a FATAL ERROR: Unhandled Access Violation Reading 0x0052 Exception at 12818950h error. Am I doing this incorrectly? Does anyone have any other ideas? I also am getting this error when I double-click on a file:

Cannot find the file "filename" (or one of its components). Make sure the path and filename are correct and that all required libraries are available.

Any ideas on this error as well?

Thanks in advance.
 
I forgot to mention that the "startup" in the lisp function is the name of a vba function that I want called. I also placed in the name of a different function name and it still gave me the error.
 
Ptti,

You really need to read up on your help files for VBA in AutoCAD - could save you allot of trial and error! :-) Also you'll get a much faster response in the VBA Customization NG:
(autodesk.autocad.cutomization.vba)

First, you should not load vba programs with "vbastmt". Both the AutoCAD command line and Visual LISP have methods specifically for loading VBA. Look up (vl-vbaload) and (vl-vbarun) in the AutoLISP reference:

(defun S:Startup
(vl-load-com)
(vl-vbaload "startup.dvb")
(vl-vbarun "startup")
)

Second, you should not use (command) within the S:STARTUP function. This has been as rule since R2000.
 
....
Second, you should not use (command) within the S:STARTUP function. This has been as rule since R2000.

That has *never* been a rule. Where did you get that idea? Look at the samples for S::Startup in the docs for instance.
 
Oops!

You're right Robert - I must have been thinking of something else. Reactors maybe?
 

Member Recommended

Back
Top