title: Export Access Query to Existing Excel Workbook (which has Macros)
body: <p>First question on Stackoverflow, have been using the site as a viewer for a long time. </p>
  
  <p>I need to export a query from Access 2010 into an existing Excel 2010 Workbook which can be either .xlsm or .xlsb (since macros work in both). I set it up the following way:</p>
  
  <ul>
  <li>User clicks a button in the Excel workbook to refresh a tab<br>
  --> this runs VBA in Excel that calls a Macro in Access to run
           ---> the macro in Access merely calls an existing query in Access to run and export the results back to the initial Excel Workbook.</li>
  </ul>
  
  <p>Access Macro Code:</p>
  
  <pre><code>DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "Data_SlotView", "M:\Merch. Strategy\Merch Forecasting\Automotive Division\File Sharing\Automotive Deal-Page-Slot View\Deal-Page-Slot-View.xlsb"
  </code></pre>
  
  <p>My code works if my Excel file was .xlsx but apparently Access 2010 does not allow exporting to Excel files with macros so I have to use some sort of workaround method. </p>