title: Saving a Macro-Enabled Workbook from a Template
body: <p>I am trying to get Access to save a Macro-Enabled file from a Macro-Enabled Template.</p>
  
  <p>I get the following errors:<br>
  1- The Excel Template is hidden using the Application.visible = False in the Thisworkbook section</p>
  
  <p><a href="https://i.stack.imgur.com/BBkIA.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BBkIA.jpg" alt="This is the error message that displays"></a></p>
  
  <p>2- Then if I click Yes to make a macro-free workbook I get the following run-time error
  <a href="https://i.stack.imgur.com/fFKjE.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fFKjE.jpg" alt="Yes-Runtime error"></a></p>
  
  <p>3- If I click no I get this run-time error
  <a href="https://i.stack.imgur.com/FTHWg.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FTHWg.jpg" alt="NO-Runtime error"></a></p>
  
  <p>This is the Code that I am using:</p>
  
  <pre><code>Workorder = Me.TxtWorkOrder &amp; "_" &amp; Me.TxtActOrder
  
  Set xlapp = New Excel.Application
  
  xlapp.Visible = False
  Excel.Application.EnableEvents = False
  
  Set Wb = xlapp.Workbooks.Open("H:\Template and testers\Template\TabletTemplate.xltm")
  Set ws = xlapp.Worksheets("Profile")
  
  ws.Activate
      If Me.TxtWorkOCheck = 1 Then
          'workorder
          With ws
              .Range("B1") = Me.TxtWorkOrder
              .Range("B2") = Me.TxtUserID
              .Range("B3") = Me.TxtJobsiteID
              .Range("B4") = Me.CboPlant.Value
              .Range("B5") = Me.CboArea.Value
              .Range("B6") = Me.TxtScaffoldID
              .Range("B7") = Me.TxtActOrder
              .Range("B10") = output
              .Range("B11") = Me.TxtFuncLocation
  
          End With
      Else
          'sub-workorder
          With ws
              .Range("B8") = Me.TxtWorkOrder
              .Range("B2") = Me.TxtUserID
              .Range("B3") = Me.TxtJobsiteID
              .Range("B4") = Me.CboPlant.Value
              .Range("B5") = Me.CboArea.Value
              .Range("B6") = Me.TxtScaffoldID
              .Range("B9") = Me.TxtActOrder
              .Range("B1") = Me.TxtAssoWorkOrder
              .Range("B10") = output
              .Range("B11") = Me.TxtFuncLocation
              .Range("F1") = 0
          End With
      End If
  
  xlapp.Worksheets("ScaffoldList").Activate
  Wb.SaveAs ("H:\ActiveWorkOrders\ToGather\" &amp; Workorder &amp; ".xlsm")
  Excel.Application.EnableEvents = True
  
  Wb.Close
  Set xlapp = Nothing
  </code></pre>