title: Set default to xlsm on "new" File -> Save As user interface, for specific template
body: <p>I have a Excel macro-enabled template (&quot;template.xltm&quot;) that, when opened normally, creates a new file without a name. Users are supposed to save it as macro-enabled file with a name of their choice.</p>
  <p>This means the first &quot;Save As&quot; for users should be limited to xlsm file format (filetype: 52). My current code is:</p>
  <pre><code>Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
  
  If wb.Path = NullString Then
  
      With Application.FileDialog(msoFileDialogSaveAs)
          .FilterIndex = 2
          If .Show Then
              ActiveWorkbook.SaveAs Filename:=.SelectedItems(1), _
                  FileFormat:=xlOpenXMLWorkbookMacroEnabled
          End If
      End With
  </code></pre>
  <p>This works if you click on the &quot;Save&quot; icon (the floppy disk icon) as it opens the &quot;old&quot; Save As interface.</p>
  <p>It does not work when you click on <strong>File -&gt; Save As</strong> that opens the &quot;new&quot; interface. This gives as first option *.xlsx instead of *.xlsm.</p>
  <p>What VBA code does ALSO trigger this interface to default to Macro-enabled files?</p>
  <p><a href="https://i.stack.imgur.com/i6tox.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/i6tox.png" alt="Image: New SaveAs interface with xlsx instead of xlsm" /></a></p>