Here is my code
Dim oexcel As Object
oexcel = CreateObject("Excel.Application")
Dim obook As Excel.Workbook
Dim osheet As Excel.Worksheet
Dim fnExc As String
Dim curLine As Integer = 0
obook = oexcel.Workbooks.Add
If oexcel.Application.Sheets.Count() < 1 Then
osheet = CType(obook.Worksheets.Add(), Excel.Worksheet)
Else
osheet = oexcel.Worksheets(1)
End If
osheet.Name = "Payroll Detail Report"
If oexcel.Application.Sheets.Count() < 2 Then
osheet = CType(obook.Worksheets.Add(), Excel.Worksheet)
Else
osheet = oexcel.Worksheets(2)
End If
osheet.Name = "Payroll Detail Report (real)"
If oexcel.Application.Sheets.Count() < 3 Then
osheet = CType(obook.Worksheets.Add(), Excel.Worksheet)
Else
osheet = oexcel.Worksheets(3)
End If
osheet.Name = "Payroll Summary Report"
If oexcel.Application.Sheets.Count() < 4 Then
osheet = CType(obook.Worksheets.Add(), Excel.Worksheet)
Else
osheet = oexcel.Worksheets(4)
End If
osheet.Move(After:=obook.Worksheets(obook.Worksheets.Count))
osheet.Name = "Weekly Payroll Report - Week 1"
obook.SaveAs(fnExc)
obook.Close()
obook = Nothing
Same video example
http://www.youtube.com/watch?v=BaYxwKUnw0U[
^]