Loading a macro from startup

Loading a macro from startup

Anonymous
Not applicable
1,612 Views
4 Replies
Message 1 of 5

Loading a macro from startup

Anonymous
Not applicable
Hi, I have a macro that creates a toolbar, the toolbar is updated now and then. I don't want it to update every time I open a new drawing or switch between drawings. I want it to update the toolbar when acad is started. And only then. Can anybody explain this newbie how to do this? Frank
0 Likes
1,613 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
From the Help File
**********
acvba.arx — Automatically Load VBA
You cannot load VBA until an AutoCAD VBA command is issued. If you want to load VBA automatically every time you start AutoCAD include the following line in the acad.rx file:

acvba.arx

You can automatically run a macro in the acad.dvb file by naming the macro AcadStartup. Any macro in your acad.dvb file called AcadStartup automatically executes when VBA loads.

acad.dvb — Automatically Load a VBA Project
The acad.dvb file is useful if you want to load a specific VBA project that contains macros you want each time you start AutoCAD. Each time you start a new AutoCAD drawing session, AutoCAD searches for the acad.dvb file and loads it.
**********
Regards - Nathan
0 Likes
Message 3 of 5

Anonymous
Not applicable
Ok, but that is when it is only for one computer, but I want to load a .dvb file that is on the network and used by several users. This because when I change something it changes for everybody. Is there a solution to that too? "Nathan Taylor" schreef in bericht news:2096519.1078782847363.JavaMail.jive@jiveforum1... > From the Help File > ********** > acvba.arx - Automatically Load VBA > You cannot load VBA until an AutoCAD VBA command is issued. If you want to load VBA automatically every time you start AutoCAD include the following line in the acad.rx file: > > acvba.arx > > You can automatically run a macro in the acad.dvb file by naming the macro AcadStartup. Any macro in your acad.dvb file called AcadStartup automatically executes when VBA loads. > > acad.dvb - Automatically Load a VBA Project > The acad.dvb file is useful if you want to load a specific VBA project that contains macros you want each time you start AutoCAD. Each time you start a new AutoCAD drawing session, AutoCAD searches for the acad.dvb file and loads it. > ********** > Regards - Nathan
0 Likes
Message 4 of 5

Anonymous
Not applicable
You can add it to your start up suite - run appload and click the contents button, then the add button. note that some people have had problems with this approach, I don't know the details though Kevin "Frank Jan Koole" wrote in message news:404d819c$1@lin2.kralog.nl... > Ok, but that is when it is only for one computer, but I want to load a .dvb > file that is on the network and used by several users. > This because when I change something it changes for everybody. > > Is there a solution to that too? > > "Nathan Taylor" schreef in bericht > news:2096519.1078782847363.JavaMail.jive@jiveforum1... > > From the Help File > > ********** > > acvba.arx - Automatically Load VBA > > You cannot load VBA until an AutoCAD VBA command is issued. If you want to > load VBA automatically every time you start AutoCAD include the following > line in the acad.rx file: > > > > acvba.arx > > > > You can automatically run a macro in the acad.dvb file by naming the macro > AcadStartup. Any macro in your acad.dvb file called AcadStartup > automatically executes when VBA loads. > > > > acad.dvb - Automatically Load a VBA Project > > The acad.dvb file is useful if you want to load a specific VBA project > that contains macros you want each time you start AutoCAD. Each time you > start a new AutoCAD drawing session, AutoCAD searches for the acad.dvb file > and loads it. > > ********** > > Regards - Nathan > >
0 Likes
Message 5 of 5

Anonymous
Not applicable
All our customisation is stored on a server and this location is added to the AutoCAD search path.

I have now gone one step further though by having a setup program that is run after AutoCAD is installed. The program copies the Acad.dvb & Acad.rx to the AutoCAD support directory so they will load for all users. All I have in the Acad.dvb is to load another DVB with all our code and run a startup procedure as follows:

**********Start Acad.dvb ThisDrawing object.
Option Explicit

Public Sub AcadStartup()
LoadDVB "Z:\RAA_UTIL04\RAA.dvb"
RunMacro "Startup.Startup"
End Sub
**********Finish Acad.dvb ThisDrawing object.

The following is what I have in the startup procedure:

**********Start RAA.dvb Startup module.
Option Explicit

Public Sub Startup()
Call AcadSettings.Preferences
Call AcadMapSettings.Aliases
Call AcadMapSettings.ProjectOptions
Call AcadMapSettings.SystemOptions
Call ApplicationEvents.InitializeEvents
LoadArx "AcadX16.arx"
End Sub
**********Finish RAA.dvb Startup module.

Regards - Nathan
0 Likes