Dealing with a macro through DAO

N

Nando

Hi all! Question: how do I either rename or delete a macro through VBA/DAO
code? This is as far as I got:

Dim mcr as Document
....
Set mcr = Containers("Scripts").Documents("MyMacro")

I tried to use automation, but when I'm calling Access to open the database
it has either a startup form and an autoexec macro that I cannot bypass. The
loading of these routines take quite some time and I would like to bypass
them (through automation/coding - no the shiftkey). All I can see from the
Access.Application object is a Visible property. For what I'm trying to do I
just need to open the database through code without triggering all these
nonsense scripts within the database. I know that DAO actually opens the
file quietly, so I'm able to change the startup form, but I'm unable to
rename the autoexec macro, since I don't see any methods exposed. Any ideas
appreciate it.
 
N

Nando

Hi Graham! Thanks very much, exactly what I need it :). The code I'm writing
does use automation to call Access, but I did notice that when I was opening
the target database all the scripting staff (startup form and autoxec
macros) started to run as well.

This is what I'll do: I will first open the database quietly with DAO to
add/set the AllowShiftKey property. Then I'll use standard automation to
bypass the Shif key as you indicated from the link to the MVPS site. After
all my automation is complete. I'll use DAO again to restore the
AllowShiftKey to its original value.

Thanks a billon!!
 
G

Graham R Seach

Nando,

That sounds like a plan! Good luck.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top