title: MS Access VBA modify Excel sheet without writing to Drive
body: <p>Not sure if this fix is possible, but worth a shot.</p>
  
  <p>I have a VBA module in my Access database to export some query results to a preexisting Excel sheet. I had no problem creating a new sheet in my C: drive and populating that with the query results. But I need to be able to modify an existing Excel sheet.</p>
  
  <p>This database will be used by many users at the same company. They will download a zip with the database and a few Excel sheets with tables and charts referencing those tables. The tables will be populated by query results from Access.</p>
  
  <p>The main issue is that with my current code, I am getting runtime error <code>3011</code> where Access can't find the query <code>tempQ1</code>. Here is my code: (sorry if it's messy)</p>
  
  <pre><code>Sub QueryExport()
  
  Dim db As DAO.Database
  Dim tempQ1 As DAO.QueryDef
  Dim tempQ2 As DAO.QueryDef
  Dim totalFindingsQuery As String
  Dim breakdownFindingsQuery As String
  
  Dim query1Name As String
  Dim query2Name As String
  query1Name = "tempQ1"
  query2Name = "tempQ2"
  
  Set db = CurrentDb
  
  totalFindingsQuery = "&lt;SQL QUERY&gt;"
  breakdownFindingsQuery = "&lt;SQL QUERY&gt;"
  
  Set tempQ1 = db.CreateQueryDef(query1Name, totalFindingsQuery)
  Set tempQ2 = db.CreateQueryDef(query2Name, breakdownFindingsQuery)
  
  'filepath will change to variable to accomodate various users
  DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, queryName1, "C:\Documents\ &lt;etc.&gt;", True
  
  DoCmd.DeleteObject acQuery, "tempQ1"
  DoCmd.DeleteObject acQuery, "tempQ2"
  
  End Sub
  </code></pre>
  
  <p>I looked at this <a href="https://social.msdn.microsoft.com/Forums/office/en-US/8cac5693-a620-4511-8784-2659904d6481/transfertext-runtime-error-3011?forum=accessdev" rel="nofollow noreferrer">https://social.msdn.microsoft.com/Forums/office/en-US/8cac5693-a620-4511-8784-2659904d6481/transfertext-runtime-error-3011?forum=accessdev</a> and found what I think my issue is -- When looking at the Properties of my C: drive, I only have "Special Permissions" checked, and I don't think I have write permissions. I cannot get this changed due to corporate policy (and none of my users can either), so I need to figure out how to modify an Excel sheet on a local drive without needing Write permissions. Is this even possible?</p>
  
  <p>Thanks in advance</p>