title: Creating folders and new *.xlsx file with macro from template like xlsm file
body: <p>I have this code that <strong>creates a folder and a saves the actual file in it, but i want that it only saves a copy with only one sheet in it</strong>. So that the file with the code works like a template...</p>
  
  <p>You write your stuff and press the button and it saves an .xlsx file with one sheet (the sheet with the form) in the new created folder... so you could do this with hundreds of files an folders.</p>
  
  <p>So in the end it should work like this: </p>
  
  <ol>
  <li>You open the .xlsm file where the code below is in.  </li>
  <li>You got to sheets one FORM (what should be "exported" later on) and
  a list where you copy stuff in the form.</li>
  <li>When you filled the form and press the button and it saves the Form
  sheet in the new folder as .xlsx and you can continue in the .xlsm
  file.</li>
  </ol>
  
  <p>If it's unclear for you please ask.</p>
  
  <p>The code i have now</p>
  
  <pre><code>Sub Macro1()
  Dim strFilename, strDirname, strPathname, strDefpath As String
  On Error Resume Next ' If directory exist goto next line
  strDirname = Range("D81").Value ' New directory name
  
  strFilename = Range("D8").Value 'New file name
  strDefpath = Application.ActiveWorkbook.Path 'Default path name
  If IsEmpty(strDirname) Then Exit Sub
  If IsEmpty(strFilename) Then Exit Sub
  
  MkDir strDefpath &amp; "\" &amp; strDirname
  strPathname = strDefpath &amp; "\" &amp; strDirname &amp; "\" &amp; strFilename 'create total string
  
  ActiveWorkbook.SaveAs Filename:=strPathname &amp; ".xlsm", _
  FileFormat:=xlOpenXMLWorkbookMacroEnabled, Password:="", WriteResPassword:="", _
  ReadOnlyRecommended:=False, CreateBackup:=False
  End Sub
  </code></pre>
  
  <p>Problem here is i have Names for the forms that are like 1102,1103 an going on like that. the next step is that there are files with the name 1102_1 and 1102_2 and they both should go in the folder 1102 ...</p>
  
  <p>It's a bit out of my knownledge please help me guys :) greets</p>
  
  <p>Now i am using this code below
  Problem is that it always closes the <code>xlsm</code> file what really annoyes and when i reopen it it wants to update the file i need to remove that but i don't know how :/... and it only should export/save one special sheet</p>
  
  <pre><code>Private Sub CommandButton1_Click()
  Dim strFilename As String, _
  strDirname As String, _
  strPathname As String, _
  strDefpath As String, _
  SheetToExport As String, _
  WbMaster As Workbook, _
  WbCopy As Workbook
  
  
  On Error Resume Next ' If directory exist goto next line
  strDirname = Range("W12").Value ' New directory name
  strFilename = Range("D8").Value 'New file name
  
  Set WbMaster = Application.ActiveWorkbook
  SheetToExport = Range("A1").Value 'Or specify UserForm output
  
  strDefpath = WbMaster.Path 'Default path name
  
  If IsEmpty(strDirname) Then Exit Sub
  If IsEmpty(strFilename) Then Exit Sub
  
  MkDir strDefpath &amp; "\" &amp; strDirname
  strPathname = strDefpath &amp; "\" &amp; strDirname &amp; "\" &amp; strFilename 'create total string
  
  WbMaster.Sheets(SheetToExport).Copy
  Set WbCopy = Application.ActiveWorkbook
  
  WbCopy.SaveAs Filename:=strPathname &amp; ".xlsx", _
                  FileFormat:=xlOpenXMLWorkbook, Password:="", WriteResPassword:="", _
                  ReadOnlyRecommended:=False, CreateBackup:=False
  
  WbCopy.Close
  End Sub
  </code></pre>