Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vb6 1

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
How do I execute an access macro from inside my vb6 project with out user intervention?

If you can help thank you!
 
You could cheat and start access with the shell command using the command line argument of /x <macroname>.

Just a thought...
 
Could also try something like the following:

You will first need to set a reference to the Microsoft Access 9.0 Object Library under the Project Menu (VB 6) or the Tools menu (MS Excel etc Module window)



Sub Button1_Click()
Dim ac As Access.Application
Set ac = New Access.Application
ac.OpenCurrentDatabase (&quot;C:\Development\Database\TEST\TEST.mdb&quot;)

'Use to run a Macro
ac.DoCmd.RunMacro &quot;MACROTEST&quot;
' or
'to run a function in a module
ac.Run (&quot;testMe&quot;)


ac.CloseCurrentDatabase
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top