AutoRun?

AutoRun?

Anonymous
Not applicable
317 Views
5 Replies
Message 1 of 6

AutoRun?

Anonymous
Not applicable
I'm Baaack - Anybody know how to embed a VBA routine in a drawing, and set it up so that it automatically runs once the drawing has finished opening? I have done it with MS Word but cannot figure out how to do it in AutoCAD, maybe you can't! But it sure sounds like I should be able to!!
Thanks again. Dave. K
0 Likes
318 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
When acad (14 anyway) opens, it runs Acad.lsp and loads Acad.dvb. For example put (command "-vbarun" "module1.test") in acad.lsp.

It seems that Private Sub AcadDocument_EndOpen(ByVal FileName As String)
' stuff here
End Sub
doesn't work too well with user interaction.

hope this helps
0 Likes
Message 3 of 6

Anonymous
Not applicable
That Sounds right, I'll give it a shot as soon as I can get back to it. But for now - got to "pump out drawings". THANKS! Dave. K
0 Likes
Message 4 of 6

Anonymous
Not applicable
Why not have your code to run setup within the S::Startup function that you can create?
0 Likes
Message 5 of 6

Anonymous
Not applicable
Okay, now that I've had a chance to take a better look - it looks like these suggsestions will run when AutoCAD is started or whenever any drawimng is open,or am I wrong? I ONLY want this routine to run when this specific drawing is opened as it will require data (blocks)that exists whithin this drawing. The drawing is a drawing of all our stock parts, and the routine allows the user to pick on the one they like and get a complete description of the part. the user is also able to open the actual part drawing to assure that it will fit their needs. I,m not sure about the startup thing but it sounds like both ideas will run the routine when "other" drawings are opened. Or am I missing it?? Thanks Dave.K
0 Likes
Message 6 of 6

Anonymous
Not applicable
true, good point...
you could just add an 'if' or 'case' statement that would load/run the programs needed depending on the filename. Either in lisp or vba.

I use (defun s::Startup()(load "lisps")(princ))
for my acad.lsp file and then have another file lisps.lsp with my lisps, that define shortcut macros for loading/running my other lisps & vba programs.
0 Likes