for i = 1 to lnNumberOfFiles if mod(1,100) = 1 FireUpExcel() endif loWorkbook = _screen.oStuff.oExcel.Workbooks.OPEN(tcFile, tlUpdateLinks) Code... Code... loWorkBook.CLOSE(tlSavetheFile) next return function FireUpExcel() if ExcelisActive() _screen.oStuff.oExcel.QUIT() _screen.oStuff.oExcel = NULL endif SET MESSAGE TO 'Activating Excel...' _screen.oStuff.oExcel = CREATEOBJECT("Excel.application") _screen.oStuff.oExcel.VISIBLE = .F. return .t.>You're saying it chokes after ~160 files, so to play if safe I'd say try 100 files at once.
>>>>FUNCTION ExcelFileOpen(toExcel, tcFile, tlUpdateLinks, toStuff, tlProtection, tcPassword, taSheetVisible) >>>> >>>>LOCAL retparm, loWorkbook >>>> >>>>retparm = .T. >>>> >>>>TRY >>>> >>>> loWorkbook = toExcel.Workbooks.OPEN(tcFile, tlUpdateLinks) >>>> >>>>CATCH TO ww >>>> >>>> errortextbuild(toStuff, ; >>>> 'Error in ' + JUSTSTEM(tcFile) + ': ' + 'File cannot be opened', .F., .T., .T.) >>>> retparm = .F. >>>> SUSPEND >>>> >>>>ENDTRY >>>>>>>>
>>>>baseclass "Exception" >>>>details "80010105: The server threw an exception" >>>>Errorno 1426 >>>>message "OLE erroe code 0x80010105: The server threw an exception" >>>>>>>>