Try this :
Add 1 Command Button to your form.
Add 1 reference to Microsoft Excel 12.0 Object Library
Project -> References -> mark the Microsoft Excel 12.0 Object Library

Private Sub Command1_Click()

    Dim xlApp As Excel.Application
    Dim xlWB As Excel.Workbook
    Dim xlWS As Excel.Worksheet

    Set xlApp = New Excel.Application
    Set xlWB = xlApp.Workbooks.Add
    Set xlWS = xlWB.Worksheets.Add

' This following lines will fill the cell (2,2) with the text "hello",
' and will fill the cell (1,3) with the text "World"
    xlWS.Cells(2, 2).Value = "hello"
    xlWS.Cells(1, 3).Value = "World"

' The following line saves the spreadsheet to "c:\mysheet.xls" file.
    xlWS.SaveAs "D:\mysheet.xls"
    xlApp.Quit

' Free memory
    Set xlWS = Nothing
    Set xlWB = Nothing
    Set xlApp = Nothing

End Sub
Comments
agree
This question has already been answered. Start a new discussion instead.