hi... how to read data from excel using vb6

Hi,

Add Microsoft Excel References to ur peoject and chek this code:

Dim xlApp As Excel.Application
   Dim wb As Workbook
   Dim ws As Worksheet
   Dim i As Integer
      
   Set xlApp = New Excel.Application
   
   Set wb = xlApp.Workbooks.Open("C:\MyExcel.xls")

   Set ws = wb.Worksheets("Sheet1")   
   'Give your worksheet name
   For i=1 To 10
    Debug.Print = ws.cells(i,1).Value
    'Do whatever u want here
   Next
      wb.Close
   
   xlApp.Quit
   
   Set ws = Nothing
   Set wb = Nothing
   Set xlApp = Nothing

Regards
Veena

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.