title: How to save a file with a name which is specified in a spreadsheet, using a .vbs file
body: <p>I'm doing some .vbs coding in which I want to open an existing template file, make some changes to it, and then 'save as' with the filename specified in cell B2.</p>
  
  <pre><code>Set objExcel = CreateObject("Excel.Application")
  
  FileDirectory = "C:\Users\j128\Desktop\"
  FileName = "TEMPLATE.xlsx"
  
  Set objWorkbook = objExcel.Workbooks.Open(FileDirectory+FileName)
  
  objExcel.Visible = True
  objExcel.Cells(2,2).value = "Variable" 'Changes will occur in this section
  
  ActiveWorkbook.SaveAs Filename = cells(2,2).value 'This is where problems occur
  </code></pre>
  
  <p>I realise I can already use Macros to name an Excel file with the value specified in a cell. However, I'm planning on using this .vbs file to name other document types using values specified in a spreadsheet.</p>
  
  <p>Thanks for any help!</p>
  
  <hr>
  
  <p>Apparently it might not be possible: <a href="https://stackoverflow.com/questions/4386124/how-can-i-use-the-common-save-as-dialog-from-vbscript">How can I use the common Save As dialog from VBScript?</a></p>
  
  <p>I've also tried using sendkeys to select 'Save as', though it falls apart when coming to name the new file.</p>