Running VBA Sub on Startup

Running VBA Sub on Startup

Anonymous
Not applicable
917 Views
5 Replies
Message 1 of 6

Running VBA Sub on Startup

Anonymous
Not applicable

Hi,

 

This should be easy.  I have an AutoCAD 2014 OEM VB.NET product which, when run, will allow the user to click a toolbar button to run my part of the program that draws.  Rather than making the user find and click my toolbar button, I'd like that command to run on startup of the AutoCAD OEM product so that my dialog window displays automatically.  IOW, the command named "callform" can be typed in to run it, or the button clicked to run it, but I want it to run when AutoCAD first starts up.

 

thanks very much.

mitch

 

0 Likes
918 Views
5 Replies
Replies (5)
Message 2 of 6

SeeMSixty7
Advisor
Advisor

You can define a startup function inside the acaddoc.lsp file. That function will execute each time a drawing is opened. Just make sure you don't already have one defined.

 

Good luck,

 

 

0 Likes
Message 3 of 6

Anonymous
Not applicable

I somehow copy/pasted the wrong subject... it is not a VBA sub that I want to run, but a command.  I can type in "callform" at the command line in my AutocAD OEM program, or I can click the toolbar button that also runs that command, and my code executes.

 

I have finally figured out (with help) that I can add a line like this to the AcadDoc.lsp file in the Support folder:

(command "LINE" "0,0,0" "1,0,0" "1,1,0" "0,1,0" "C")

 

... and it will draw a box upon startup.

 

However, I have an OEM program.  This doesn't work here.  I've tried aoemDoc.lsp instead, but that doesn't work either.

 

Ideally I'd like to put this line in a startup lsp file:

 

(command "Callform") and it would run my code.

 

Any suggestions?

0 Likes
Message 4 of 6

SeeMSixty7
Advisor
Advisor
Is it a lisp command? If sotryvsimply calling it as a function

Instead of (command ...)

Try
(C:callform)

Good luck
0 Likes
Message 5 of 6

Anonymous
Not applicable
It's not a lisp command. My code is VB.NET and is embedded into my OEM program. It's actually called BugCAD.exe, so I created a file named BugcadDOC.lsp and put it into the appropriate (?) ...\Support\ folder. I've used several iterations of that command line, including just (C:callform) now (thanks).

I suspect that it may be an OEM thing... functionality may not be the same as it is for normal AutoCAD... I could get "(command "LINE" "0,0,0" "1,0,0" "1,1,0" "0,1,0" "C")" to work there, but not in my OEM folder.

Hoped it would be easier than this! thanks very much.
mitch
0 Likes
Message 6 of 6

Anonymous
Not applicable
0 Likes