Running Access Macro from Excel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zwheeler
    New Member
    • Mar 2010
    • 2

    #1

    Running Access Macro from Excel

    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

    Code:
    Dim strDB As String
        Dim A As Object
        Application.ScreenUpdating = False
         
        Set A = CreateObject("Access.Application")
        strDB = "C:\od_track.mdb"
         
        A.OpenCurrentDataBase strDB
        A.Visible = False
        A.DoCmd.RunMacro "OD PROJECTIONS MACRO"
    'Note: i even tried "[OD PROJECTIONS MACRO]"
        A.Quit
    Any help would be greatly appreciated
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    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.

    Comment

    Working...