title: Excel vba | running a access macro from excel
body: <p>I get the following message whenever  I try to execute the following code. </p>
  
  <pre><code>Sub Refresh_Pivot()
  Dim AWB As Workbook
  Dim pvtTable As Object
  Dim appAccess As Object
  
  'Save workbook
  Set AWB = ActiveWorkbook
  AWB.Save
  
     'Open Access Application
     Set appAccess = CreateObject("Access.Application")
     appAccess.OpenCurrentDatabase "S:\AMA\MPF\MPF Projects\MPF Loss Emergence\MPFV4.accdb"
     appAccess.Visible = True
  
  'Set Message bar in excel t o notify user of update process
  oldStatusBar = Application.DisplayStatusBar
  Application.DisplayStatusBar = True
  Application.StatusBar = "Retrieving information, please be patient...."
  
  
  
    'Execute Access Macro containing lineup of queries and scrubs
    appAccess.DoCmd.RunMacro "0_Retrieve_Scrub"  '&lt;-- As it appears in the Macro Group in the Access Interface.
  
  
         'Close Access
  
         appAccess.DoCmd.Quit
  
  
         'Return message bar to original status
          Application.StatusBar = False
          Application.DisplayStatusBar = oldStatusBar
  
  
      Set pvtTable = Worksheets("1. Roll Rate Pivots").Range("C13").PivotTable
      pvtTable.RefreshTable
  
      Columns("B:B").EntireColumn.AutoFit
      Columns("C:j").Select
      Selection.ColumnWidth = 13
  
    'Notify user process has completed
    MsgBox ("Update complete")
  End Sub
  </code></pre>
  
  <p>It basically opens a Access dbase, runs a Access macro and closes Access. I have an ODBC connection to the table that is created by the macro in the same excel file that this code is triggered from. I have this running successfully in excel 2007. We recently upgrade office 2013, we started to receive this message. When we debug, it highlights this line of code. At first I though it had something to do with the object library for that version, all the latest one is checked. Has anyone encountered a similar issue. Any help would be greatly appreciated.</p>
  
  <p><strong>appAccess.DoCmd.RunMacro "0_Retrieve_Scrub"</strong>  </p>
  
  <p><a href="http://i.stack.imgur.com/qQZCM.png" rel="nofollow">Error message</a></p>