Click to See Complete Forum and Search --> : Running A Macro From VB
nmretd
Oct 20th, 1999, 09:44 PM
Can anyone show me how I can run a macro from within VB without having to open Access 97 ?
Clunietp
Oct 20th, 1999, 10:12 PM
This should work (i didn't test it though..)
1) Add a reference to the Microsoft Access 8.0 Object Library
2) Add this code:
Dim axs As New Access.Application
axs.OpenCurrentDatabase ("c:\file\path\here.mdb")
axs.DoCmd.RunMacro "MacroName"
axs.CloseCurrentDatabase
Set axs = Nothing
All done!
HTH
Tom
nmretd
Oct 20th, 1999, 10:49 PM
Thank you Clunietp, that worked fine.
Regards
nmretd
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.