Hello friends,

I'm tring to make excel file using vb but i don't know how to do it.
There anyone know how to do this. Thank you.

Eko

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
commented: agree +3

hi, i want to know how to use exel tables

@tope.felix.1 : make your own thread. don't hijack other thread.

Thank you jx_man

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.