By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,826 Members | 2,443 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,826 IT Pros & Developers. It's quick & easy.

Running Access Macro from Excel

P: 2
I am trying to run an access macro from an excel application. i found the following code and tried to implement it but i keep getting a error 2046:

i go to references and set the references to :
Microsoft Access 12.0 Object Library

Expand|Select|Wrap|Line Numbers
  1. Dim strDB As String
  2.     Dim A As Object
  3.     Application.ScreenUpdating = False
  5.     Set A = CreateObject("Access.Application")
  6.     strDB = "C:\od_track.mdb"
  8.     A.OpenCurrentDataBase strDB
  9.     A.Visible = False
  10.     A.DoCmd.RunMacro "OD PROJECTIONS MACRO"
  11. 'Note: i even tried "[OD PROJECTIONS MACRO]"
  12.     A.Quit
Any help would be greatly appreciated
Apr 1 '10 #1
Share this Question
Share on Google+
1 Reply

Expert 5K+
P: 8,636
The code, in and of itself, is fully operational and produced no Error on my end. It was tested in Access 2002. The problem may lie with the Macro itself and what it is attempting to do. Create another, simple Macro, say just a Message Box, and see what happens when you try to execute it from Excel.
Apr 1 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.