title: Export Range to New Excel Document VBA
body: <p>I am new to VBA but working on some reports and it would be a lot simpler to create a macro button to auto export a defined range to a new .xlsx document.</p>
  
  <p>I have so far:</p>
  
  <pre><code>Sub ExportTest()
      Dim WS As Worksheet
      Dim Rng As Range
      Set Rng = Range("A1:K10")
      Application.Workbooks.Add
      Set WS = Application.ActiveSheet
      Rng.Copy Destination:=WS.Range("A1")
      WS.SaveAs "test", ".xlsx"
  End Sub
  </code></pre>
  
  <p>I get error 1004, which seems to be an issue with the SaveAs part.</p>
  
  <p>But cannot figure out how to auto save this to a pre-defined folder.
  Also if possible would it be possible to reference the filename as a cell in the original workbook?</p>