Automatically run a macro

Automatically run a macro

Anonymous
Not applicable
400 Views
5 Replies
Message 1 of 6

Automatically run a macro

Anonymous
Not applicable
Hi!
I have created super-program:
;;;;;;;;;;;;;;;;;;;;;;;;
Sub Hello()
msgbox "Hello_World"
end sub
;;;;;;;;;;;;;;;;;;;;;;;;;
Then saved this file as Hello.dvb in D:\\, then added line in the end of file acad2008doc.lsp this line:
(vl-vbarun "D:\\Hello.dvb!Hello")
Now, when i try open multiple files from SheetSet, Autocad hanging (in command line "macro name:").
Any solution?
0 Likes
401 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
Hi,
Just put in AcadDoc.lsp or Acad.lsp this :

(defun c:vbRUNRoutine ()
(vl-load-com)
(vl-vbarun "Acad.dvb!ModuleName.RoutineNAme")
)

And put

acvba.arx in a file text name :

acad.rx

This run automaticaly Acad.dvb

Now command line:
vbRUNRoutine

Run VBA routine !

A french user
Daniel OLIVES
0 Likes
Message 3 of 6

Anonymous
Not applicable
It does not work. I want to execute automatically my macro each time by starting a new drawing or opening an existing one. Try to open multiple files from SheetSet Manager
0 Likes
Message 4 of 6

Anonymous
Not applicable
hi,
fisrt
Have a look at how use acad.lsp or acaddoc.lsp in help of acad
in acad.lsp you can add:

(defun S::STARTUP()
(vl-vbarun "ACADStartup") ;
) ; fin S::STARTUP

By this way you can run in lisp starup a vba routine !

and in acad.dvb Thisdrawwing

Option Explicit
Public WithEvents acadApp As AcadApplication
Sub ACADStartup()
' your commands
end sub

Private Sub ACADApp_AppActivate()
' first activation of acad
End Sub

Did you have put :

acad.rx file with files acad.dvb, acad.lsp

and define file path in support path ?

Daniel OLIVES
0 Likes
Message 5 of 6

Anonymous
Not applicable
Thanks Daniel!
BUT: this is NOT working when i simultaneously open multiple layouts from SheetSet Manager. Try it yourself
0 Likes
Message 6 of 6

Anonymous
Not applicable
Open the System tab of the Options GUI and check "Load acad.lsp with every drawing"
0 Likes