inwmsn Posted December 25, 2008 Share Posted December 25, 2008 Hi There, I couldn't figure out how to define the exactly array range in _ExcelReadArray as following _ExcelReadArray($oExcel, $iStartRow, $iStartColumn, $iNumCells, $iDirection = 0, $iIndexBase = 0) When this function running, it read the whole data range depend on $iNumberCells defined. If I set as 255, It will read up to 255 in range event there is only 3 data in range. So, it will read nothing afther 3rd range when I put into loop. For example In the email.xls; A1 - xxxx@hotmail.com A2 - yyyy@gmail.com A3 - zzzz@yahoo.com ------------------------------------------------------------------------- $oExcel = "d:\scripts\email.xls" _ExcelBookOpen ($oExcel,1) Dim $import = _ExcelReadArray($oExcel, 1, 1, 255, 1, 1) _ExcelBookClose($oExcel) For $i = 1 To Ubound ($import) -1 MsgBox (0,0,$import[$i]) Next ------------------------------------------------------------------------- Result The script will keep looping popup the message until A255 range. Question How can I give the script stop looping after A3 or stop after empty data range? Thanks Link to comment Share on other sites More sharing options...
flyingboz Posted December 25, 2008 Share Posted December 25, 2008 How can I give the script stop looping after A3 or stop after empty data range?test the result ; i.e. if StringLen(StringStripWs($result,3)) = 0 then ..... Reading the help file before you post... Not only will it make you look smarter, it will make you smarter. Link to comment Share on other sites More sharing options...
inwmsn Posted January 1, 2009 Author Share Posted January 1, 2009 You are a man! Thanks so much. Hi There, I couldn't figure out how to define the exactly array range in _ExcelReadArray as following _ExcelReadArray($oExcel, $iStartRow, $iStartColumn, $iNumCells, $iDirection = 0, $iIndexBase = 0) When this function running, it read the whole data range depend on $iNumberCells defined. If I set as 255, It will read up to 255 in range event there is only 3 data in range. So, it will read nothing afther 3rd range when I put into loop. For example In the email.xls; A1 - xxxx@hotmail.com A2 - yyyy@gmail.com A3 - zzzz@yahoo.com ------------------------------------------------------------------------- $oExcel = "d:\scripts\email.xls" _ExcelBookOpen ($oExcel,1) Dim $import = _ExcelReadArray($oExcel, 1, 1, 255, 1, 1) _ExcelBookClose($oExcel) For $i = 1 To Ubound ($import) -1 MsgBox (0,0,$import[$i]) Next ------------------------------------------------------------------------- Result The script will keep looping popup the message until A255 range. Question How can I give the script stop looping after A3 or stop after empty data range? Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now