title: Can I get Access to automatically name a file export with a variable part of the file name and a fixed part of the filename
body: <p>I am working on an Access 2014 DB that exports the results of a query to an excel file that can be sent to a third party.  I want the resulting excel file to go to a specified folder on a shared drive, with a naming scheme of "serialnumber vendor ASL.xlsx"</p>
  
  <p>Any hints I should look at, pointers to websites that I did not find with Duck Duck Go, all would be greatly appreciated</p>
  
  <p>Right now I am using a simple Macro to export the file with the "ExportWithFormatting" but I cant seem to get anything going in the "Output File" box that gives me any flexibility.  </p>
  
  <p>I suspect this can be done with VBS, but I'm pretty shaky when it comes to establishing and running a VBS module.  I converted the Macro to a VBS Module, but I have no idea where to go from here.</p>
  
  <pre><code>Option Compare Database
  
  '------------------------------------------------------------
  ' expord_ASL_to_Excel
  '
  '------------------------------------------------------------
  Function expord_ASL_to_Excel()
  On Error GoTo expord_ASL_to_Excel_Err
  
      DoCmd.OutputTo acOutputQuery, "Match up", "ExcelWorkbook(*.xlsx)", "", True, "", , acExportQualityPrint
  
  
  expord_ASL_to_Excel_Exit:
      Exit Function
  
  expord_ASL_to_Excel_Err:
      MsgBox Error$
      Resume expord_ASL_to_Excel_Exit
  
  End Function
  </code></pre>
  
  <p>I tinkered with it a bit, but I can't get it to do anything.  I am currently trying to backtrack through the basics of running a VBS module, so I don't need any help with that yet.  I'm just trying to figure out this little bit of finesse going.</p>