title: run access macro within excel
body: <p>I want within excel vba to run an access macro and also copy an access query.<br>
  When I run the code below, I get an runtime error 3001 on line cn.DoCmd.RunMacro "runCopyqueryVragenlijsten"</p>
  
  <pre><code>'~~&gt; Select access file Database Questionmark.mdb
  Set cn = CreateObject("adodb.connection")
  Set rs = CreateObject("adodb.recordset")
  cn.Open "provider=microsoft.jet.oledb.4.0;data source=D:\Data\Geschiktheidstesten en OPQ-rapport NMBS competenties\Analyse\Database Questionmark.mdb"
  
  '~~&gt; Run access macro
  cn.DoCmd.RunMacro "runCopyqueryVragenlijsten"
  
  '~~&gt; Select access query to copy
  rs.Open "select * from Copyquery_Vragenlijsten", cn
  
  '~~&gt; paste access query in sheet vragenlijst
  Worksheets("vragenlijst").Range("a2").CopyFromRecordset rs
  
  '~~&gt; Close access file and put cursor on cell A1 of sheet evaluatierooster_NL
  rs.Close
  Set rs = Nothing
  Set cn = Nothing
  </code></pre>