Thanks for helping me on this issue
I tried that and i was successful to read data but problem is
excel.exe is continously running in the program and untill i end that
program, i can not able to open that worksheet.
plese let me know if i missed something.
-thanks
kirat
This is my program that i made
Option Explicit
Private xlsApp As Excel.Application
Private xlsWB As Excel.Workbook
Private Sub Command1_Click()
Set xlsApp = CreateObject("Excel.Application")
Static xlfilename As String
xlfilename = Text1.Text
Set xlsWB = xlsApp.Workbooks.Open(xlfilename)
Static Lines As Integer
Static intmsg As String
Static CellData As Integer
Static maxline, mvalue As Integer
' fill the spreadsheet control with the contents of the actual
file
' this keeps the actual file intact
' Open import file,,readonly
' ' get how many records are in the excel file for the progress bar
Static xlWorksheet As String
xlWorksheet = "sheet1"
Static ncycle As Integer
ncycle = Val(Text2.Text)
Dim StrVar(1000, 1000) As Integer
' Lines = 1
'CellData = 2 ' need to have something to start the loop
'Do While CellData <> 10101
' CellData = xlsApp.ActiveCell.Cells(Lines, 1)
' Lines = Lines + 1
'Loop
' loop through the data and save it to the preview table
'maxline = Lines - 1
Static CellRow, CellCol, BlankCell As Integer
CellRow = 0
Do While CellRow <= ncycle
CellRow = CellRow + 1
If xlsWB.Worksheets(xlWorksheet).Cells(CellRow, 1) = 10101 Then
Exit Do
CellCol = 1
BlankCell = 0
Do While CellCol <= 2
StrVar(CellRow, CellCol) =
xlsWB.Worksheets(xlWorksheet).Cells(CellRow, CellCol)
CellCol = CellCol + 1
Loop
mvalue = CellRow
Loop
xlsWB.Close
' Quit Excel.
xlsApp.Quit
' Close the object references.
Set xlsWB = Nothing
Set xlsApp = Nothing
mvalue = 0
intmsg = MsgBox("done")
End Sub
>> Stay informed about: to import data from excel sheet