title: Run time error '1004': Copy method of worksheet class failed
body: <p>I want to split workbook by worksheet name but if throws above error after splitting 5 sheets but i have 20 sheets in the workbook. I have used below code and the error happens at xWs.copy.</p>
  
  <p>Please help me fix the error in the code. Thanks in advance.</p>
  
  <pre><code>Sub Splitbook()
  'Updateby20140612
  Dim xPath As String
  xPath = Application.ActiveWorkbook.Path
  Application.ScreenUpdating = False
  Application.DisplayAlerts = False
  For Each xWs In ThisWorkbook.Sheets
      xWs.Copy
      Application.ActiveWorkbook.SaveAs Filename:=xPath &amp; "\" &amp; xWs.Name &amp; ".xlsx"
      Application.ActiveWorkbook.Close False
  Next
  Application.DisplayAlerts = True
  Application.ScreenUpdating = True
  End Sub
  </code></pre>