954,535 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

vb6-excel

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

guru511
Light Poster
42 posts since Jul 2007
Reputation Points: 10
Solved Threads: 3
 

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

QVeen72
Posting Shark
950 posts since Nov 2006
Reputation Points: 84
Solved Threads: 143
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You