title: Add new sheet to existing Excel workbook with VB code
body: <p>This code creates an Excel file with one sheet.  This sheet contains the code of an item like (ASR/Floor/Dept./Item_Name/Item_details/1) which I created and works fine, but I want to add a sheet into this Excel file to create another item code, and then save this file.</p>
  
  <pre><code>Dim xlApp As Excel.Application
  Dim wb As Workbook
  Dim ws As Worksheet
  Dim var As Variant
  Dim code As String
  Dim i, nocode As Integer
  Dim fname, heading As String
  
  code = "ASR/" &amp; Text1.Text &amp; "/" &amp; Text2.Text &amp; "/" &amp; Text3.Text &amp; "/" &amp; Text4.Text
  
  Set xlApp = New Excel.Application
  Set wb = xlApp.Workbooks.Add ' Create a new WorkBook
  Set ws = wb.Worksheets("Sheet1") 'Specify your worksheet name
  
  nocode = txtnocode.Text
  heading = Text6.Text
  
  For i = 2 To nocode + 1
    ws.Cells(i, 1).Value = code &amp; "/" &amp; i - 1 '"ORG"
  Next i
  
  fname = "c:\" &amp; Text5.Text &amp; ".xls"
  
  wb.SaveAs (fname)
  wb.Close
  xlApp.Quit
  
  Set ws = Nothing
  Set wb = Nothing
  Set xlApp = Nothing
  </code></pre>