A couple of samples which should do what you want...
' Declare Excel object variables and create types
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
xlApp = CType(CreateObject("Excel.Application"), Excel.Application)
xlBook = CType(xlApp.Workbooks.Add, Excel.Workbook)
xlSheet = CType(xlBook.Worksheets(1), Excel.Worksheet)
' Insert data
xlSheet.Cells(1, 2) = 5000
xlSheet.Cells(2, 2) = 75
xlSheet.Cells(3, 1) = "Total"
' Insert a Sum formula in cell B3
xlSheet.Range("B3").Formula = "=Sum(R1C2:R2C2)"
' Format cell B3 with bold
xlSheet.Range("B3").Font.Bold = True
' Display the sheet
xlSheet.Application.Visible = True
' Save the sheet to c:\vbnetsbs\chap13 folder
xlSheet.SaveAs("C:\myexcelsheet.xls")
' Leave Excel running and sheet open
Dim EXL As New Excel.Application()
Dim WSheet As New Excel.Worksheet()
WSheet = EXL.Workbooks.Add.Worksheets.Add
With WSheet
.Cells(2, 1).Value = "1st Quarter"
.Cells(2, 2).Value = "2nd Quarter"
.Cells(2, 3).Value = "3rd Quarter"
.Cells(2, 4).Value = "4th Quarter"
.Cells(2, 5).Value = "Year Total "
.Cells(3, 1).Value = 123.45
.Cells(3, 2).Value = 435.56
.Cells(3, 3).Value = 376.25
.Cells(3, 4).Value = 425.75
.Range("A2:E2").Select()
With EXL.Selection.Font
.Name = "Verdana"
.FontStyle = "Bold"
.Size = 12
End With
End With
WSheet.Range("A2:E2").Select()
EXL.Selection.Columns.AutoFit()
WSheet.Range("A2:E2").Select()
With EXL.Selection
.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter
End With
' Format numbers
WSheet.Range("A3:E3").Select()
With EXL.Selection.Font
.Name = "Verdana"
.FontStyle = "Regular"
.Size = 11
End With
WSheet.Cells(3, 5).Value = "=Sum(A3:D3)"
Dim R As Excel.Range
R = WSheet.UsedRange
Dim row, col As Integer
For row = 1 To R.Rows.Count
TextBox1.AppendText("ROW " & row & vbCrLf)
For col = 1 To R.Columns.Count
TextBox1.AppendText("[" & row & ", " & col & _
" : " & vbTab & R.Cells(row, col).value & "]" & vbCrLf)
Next
TextBox1.AppendText(vbCrLf)
Next
Try
WSheet.SaveAs("C:\TEST.XLS")
Catch
End Try
Me.Text = "File Created"
EXL.Workbooks.Close()
EXL.Quit()