Hi,
How can I search a string in an excel-file.
I know how to openen it , write in it, but not how to search in it
I the string is found, I want to know the column and row.
Try
oEXCEL := TOleAuto():New( "Excel.Application" )
Catch
Saying := "Error in Opening Excel object"+chr(10)
Saying += "Make sure you have MS Excel loaded on your Computer"+chr(10)
MsgInfo( Saying )
Return(.f.)
End Try
Try
oExcel:Workbooks:Open( cPATH ) // path and excel file c:\files\yourfile.xls
Catch
Saying := "Error in Opening Excel Workbook"
MsgInfo( Saying )
Return(.f.)
End Try
oBook := oExcel:Get( "ActiveSheet" )
nROWS := oBook:UsedRange:Rows:Count()
nCOLS := oBook:UsedRange:Columns:Count()
FOR nStartRow := nRow to nROWS
For nCOL := 1 to nCOLS
xVALUE := oBook:Cells( nStartRow, nCOL):Value
// test xValue for your string
// nStartRow and nCOl is the current cell
Next
Next
oExcel:Quit()
Rick Lipkin wrote:Marc
Consider this code :
Rick Lipkin
[/code]
nageswaragunupudi wrote:There is
oRange:Find( target, ......... )
method available
Please check for this method in VBA online help.
(Open excel and click help )
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 107 guests