title: Copy and Rename Excel ActiveSheet in vba
body: <p>I am generating a command button in access that will export data into Excel. At present, I have this function working and am trying to perfect it a little more such that each export will export the data onto a new sheet which will effectively be a copy of the ActiveSheet. The code that seems to be failing me is: </p>
  
  <pre><code>'Open workbook
  
  Excel.Workbooks.Open "\\aos03s-fp04\brewsti2$\Alarms\ExportTest - " &amp; Format(Now(), "dd-mm-yyyy") &amp; ".xlsx", True, False
  
  'Copy initial activesheet
  
  ActiveSheet.Copy Before:=Excel.Sheets("Sheet2")
  
  'Rename new copied sheet
  
  ActiveSheet.Name = Me.RAW_TAG
  </code></pre>
  
  <p>The code fails on the ActiveSheet.Copy function. Any ideas?</p>