Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
xlBook.Worksheets(3).Delete
xlBook.Worksheets(2).Delete
With xlSheet
.PageSetup.Orientation = 2
.PageSetup.LeftMargin = 0
.PageSetup.TopMargin = 0
.Cells.WrapText = False
.Cells.Font.Size = 8
Dim dt
dt = Date
.Range("A1").ColumnWidth = 3
.Range("B1").ColumnWidth = 13
.Range("C1").ColumnWidth = 6
.Range("B1").Value = dt
.Range("A2").Value = "Name"
.Range("A2").Font.Name = "Monotype Corsiva"
.Range("A2").Font.Size = 14
.Range("A3").Value = "Address1"
.Range("A3").Font.Bold = True
.Range("A4").Value = "Address2"
.Range("A4").Font.Bold = True
.Range("A5").Value = "Phone Number"
.Range("A5").Font.Bold = True
.Range("A6").Value = "Cashier: " & FormStart.Text1
.Range("A6").Font.Bold = True
.Range("A7").Value = "Invoice #: " & Text4
.Range("A7").Font.Bold = True
.Range("A8").Value = Combo1.Text
.Range("A8").Font.Bold = True
.Range("A9").Value = "----------------------------------------"
.Range("A10").Value = "Qty"
.Range("A10").Font.Bold = True
.Range("B10").Value = "Item"
.Range("B10").Font.Bold = True
.Range("C10").Value = "Price"
.Range("C10").Font.Bold = True
.Range("A11").Value = "----------------------------------------"
For i = 1 To MSF.Rows - 1
For j = 1 To 3
xlSheet.Cells(11 + i, j) = MSF.TextMatrix(i, j - 1)
Next j
Next i
k = 11 + i
.Range("A" & k).Value = "Discount"
.Range("A" & k).Font.Bold = True
.Range("C" & k).Value = Text2 & " %"
k = k + 2
.Range("B" & k).Value = "TOTAL " & Text1 & " $"
.Range("B" & k).Font.Size = 12
.Range("B" & k).Font.Bold = True
End With
xlApp.Visible = False
'xlSheet.PrintOut (1)
Dim y
y = "Sample.xls"
xlSheet.SaveAs (y)
xlApp.Workbooks.Close