Can't get VBA to initialize automatically at startup

Can't get VBA to initialize automatically at startup

Anonymous
Not applicable
409 Views
5 Replies
Message 1 of 6

Can't get VBA to initialize automatically at startup

Anonymous
Not applicable
I want to set some preferences when AutoCAD 2000 is opened. I have written
a procedure that works when I invoke it directly. I have placed it in
acad.dvb in the acad root directory ACAD2000. The sub is named
acadStartup() and should run automatically when the application is started.
The problem is that VBA is NOT being initialized at startup - the project
file is loaded but the sub does not run. When I open
Tools/Macro/Macros..., VBA Manager, Load Project..., or press alt_F11
(anything that addresses the VBA facilities) VBA is initialized and the
startup macro runs properly.

While this is probably easily resolved, I cannot find an answer from on- and
off-line documentation. I've installed all the VBA components in the
installation process. I have the same problem on two PCs. Help.

Jim Christenson
0 Likes
410 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
Have you added ACADVBA.ARX to your ACAD.RX file?

--
http://www.acadx.com
0 Likes
Message 3 of 6

Anonymous
Not applicable
Yo Jimster,

Put the following code (or something similar) into acad.lsp:

(defun S::STARTUP()
(command "_-VBARUN" "acadStartup")
)

NOTE, this will cause acadStartup to be run twice though. To get around
this, you can do one of two things:

1. Rename acadStartup to some other name and place that in the code:
(defun S::STARTUP()
(command "_-VBARUN" "SomeotherSub")
)
2. You can create a dummy, blank sub and call that from acad.lsp while
leaving acadStartup as it was.

VBA is not automatically loaded when you start AutoCAD. Applying this code
to acad.lsp will force VBA to be loaded. Upon loading, VBA will
automatically execute the code in acadStartup.

Adios,

SKH

"Jim Christenson" wrote in message
news:1418E5656A406F8357957E149600B7C2@in.WebX.maYIadrTaRb...
> I want to set some preferences when AutoCAD 2000 is opened. I have
written
> a procedure that works when I invoke it directly. I have placed it in
> acad.dvb in the acad root directory ACAD2000. The sub is named
> acadStartup() and should run automatically when the application is
started.
> The problem is that VBA is NOT being initialized at startup - the project
> file is loaded but the sub does not run. When I open
> Tools/Macro/Macros..., VBA Manager, Load Project..., or press alt_F11
> (anything that addresses the VBA facilities) VBA is initialized and the
> startup macro runs properly.
>
> While this is probably easily resolved, I cannot find an answer from on-
and
> off-line documentation. I've installed all the VBA components in the
> installation process. I have the same problem on two PCs. Help.
>
> Jim Christenson
>
0 Likes
Message 4 of 6

Anonymous
Not applicable
Yo Jimster,

Put the following code (or something similar) into acad.lsp:

(defun S::STARTUP()
(command "_-VBARUN" "acadStartup")
)

NOTE, this will cause acadStartup to be run twice though. To get around
this, you can do one of two things:

1. Rename acadStartup to some other name and place that in the code:
(defun S::STARTUP()
(command "_-VBARUN" "SomeotherSub")
)
2. You can create a dummy, blank sub and call that from acad.lsp while
leaving acadStartup as it was.

VBA is not automatically loaded when you start AutoCAD. Applying this code
to acad.lsp will force VBA to be loaded. Upon loading, VBA will
automatically execute the code in acadStartup.

Adios,

SKH

"Jim Christenson" wrote in message
news:1418E5656A406F8357957E149600B7C2@in.WebX.maYIadrTaRb...
> I want to set some preferences when AutoCAD 2000 is opened. I have
written
> a procedure that works when I invoke it directly. I have placed it in
> acad.dvb in the acad root directory ACAD2000. The sub is named
> acadStartup() and should run automatically when the application is
started.
> The problem is that VBA is NOT being initialized at startup - the project
> file is loaded but the sub does not run. When I open
> Tools/Macro/Macros..., VBA Manager, Load Project..., or press alt_F11
> (anything that addresses the VBA facilities) VBA is initialized and the
> startup macro runs properly.
>
> While this is probably easily resolved, I cannot find an answer from on-
and
> off-line documentation. I've installed all the VBA components in the
> installation process. I have the same problem on two PCs. Help.
>
> Jim Christenson
>
0 Likes
Message 5 of 6

Anonymous
Not applicable
Jim,

You need to take care that acadvba.arx is loaded first. To do so you can
adopt any one of the following ways:
1. Add acadvba.arx to the startup suite in the appload dialog.
2. Create a file acad.rx with the line acadvba.arx .
3. Load it with the help of acad.lsp.

Cheers,
Thilak

"Jim Christenson" wrote in message
news:1418E5656A406F8357957E149600B7C2@in.WebX.maYIadrTaRb...
> I want to set some preferences when AutoCAD 2000 is opened. I have
written
> a procedure that works when I invoke it directly. I have placed it in
> acad.dvb in the acad root directory ACAD2000. The sub is named
> acadStartup() and should run automatically when the application is
started.
> The problem is that VBA is NOT being initialized at startup - the project
> file is loaded but the sub does not run. When I open
> Tools/Macro/Macros..., VBA Manager, Load Project..., or press alt_F11
> (anything that addresses the VBA facilities) VBA is initialized and the
> startup macro runs properly.
>
> While this is probably easily resolved, I cannot find an answer from on-
and
> off-line documentation. I've installed all the VBA components in the
> installation process. I have the same problem on two PCs. Help.
>
> Jim Christenson
>
0 Likes
Message 6 of 6

Anonymous
Not applicable
We are autoloading an event driven vba routine to enforce file naming
standards. Frank is right, once acadvba.arx is loaded you'll see a response
at the command line saying "Autocad VBA initializing", then your routine
will start.

Richard Binning
CAD Coordinator
The Haskell Company

"Jim Christenson" wrote in message
news:1418E5656A406F8357957E149600B7C2@in.WebX.maYIadrTaRb...
> I want to set some preferences when AutoCAD 2000 is opened. I have
written
> a procedure that works when I invoke it directly. I have placed it in
> acad.dvb in the acad root directory ACAD2000. The sub is named
> acadStartup() and should run automatically when the application is
started.
> The problem is that VBA is NOT being initialized at startup - the project
> file is loaded but the sub does not run. When I open
> Tools/Macro/Macros..., VBA Manager, Load Project..., or press alt_F11
> (anything that addresses the VBA facilities) VBA is initialized and the
> startup macro runs properly.
>
> While this is probably easily resolved, I cannot find an answer from on-
and
> off-line documentation. I've installed all the VBA components in the
> installation process. I have the same problem on two PCs. Help.
>
> Jim Christenson
>
0 Likes