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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling Access macros from Excel

Status
Not open for further replies.

millzy7

Programmer
Dec 9, 2003
96
US
hi

i want to call a macro in an access database from my excel vba code. is this possible

Thanks
 
Yep try:

Code:
DatabaseName$ = "C:\Database.mdb"
Set acApp = CreateObject("Access.Application")
acApp.Visible = True
acApp.OpenCurrentDatabase (DatabaseName$)
acApp.DoCmd.RunMacro "YourMacroName"
 


Also...

be sure that you have a reference (Tools/References) set to the Microsoft Access n.m Object Library.

Skip,

[glasses] [red][/red]
[tongue]
 
Thanks, thats helped a lot.

If i want to select * from a query, how can i pass in the required parameters for the query?

Thanks
Millzy
 
how does that relate to calling a macro?

If you have another question, start another thread....

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top