PDA

View Full Version : show user form from a command line argument



lambertm
2004-11-30, 09:58 AM
I am currently writing an application in VBA / Cad 2005 and would like to know if it is possible to show a user form when a command is typed in at the command line. At present the form is shown when the save button is clicked.

Coolmo
2004-11-30, 09:36 PM
I'll use an example for a command line entry of DRAWLINE

Set up a module in your project and put this in it:



Public Sub Drawline() 'where Drawline would be your command line entry
Userform1.Show
End Sub


Then set up a quick lisp routine inside your acaddoc.lsp, acad.mnl, or acad.lsp file with this in it:


(defun c:Drawline () (command "-vbarun" "Drawline"))

This will load every time a drawing loads and will set up the command "Drawline" to run the macro "Drawline" and thus load your userform. This is my method but I'm sure there's plenty of other ways out there. Good luck.