Option Explicit > >Private Sub Command1_Click() > Dim xlShell > Dim xlApp As Object > Dim xlBook As Object > Dim xlSheet As Object > Dim nWorkSheetCtr As Integer > Dim i As Integer > Dim cFileName As String > > Set xlApp = CreateObject("Excel.Application") > Set xlBook = xlApp.Workbooks.Add > nWorkSheetCtr = 0 > Do Until xlBook.Worksheets.Count = 4 > xlBook.Worksheets.Add > Loop > > For i = 1 To 4 > nWorkSheetCtr = nWorkSheetCtr + 1 > Set xlSheet = xlBook.Worksheets(nWorkSheetCtr) > > xlSheet.Cells(1, 1) = "TEST REPORT SYSTEM" > xlSheet.Cells(2, 1) = "SAMPLE REPORT" > xlSheet.Cells(3, 1) = "Run Date/Time: " & Now > > xlSheet.Cells(6, 1) = "NAME" & Trim(Str(i)) > xlSheet.Cells(6, 2) = "POSITION" > Next i > > > cFileName = "c:\temp\test.xls" > xlBook.SaveAs cFileName > xlBook.Close > Set xlSheet = Nothing > Set xlBook = Nothing > Set xlApp = Nothing > > xlShell = Shell("C:\Program Files\Microsoft Office\Office\Excel.exe " + cFileName, vbNormalFocus) > >End Sub