ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Limits on opening Excel Workbooks (https://www.excelbanter.com/excel-programming/364854-limits-opening-excel-workbooks.html)

Seymour

Limits on opening Excel Workbooks
 
Using the C Excel API, I am attempting to open, read, and close numerous
Excel workbooks. A representative code snippet is below. After opening the
same 4 meg file 936 times, get an inexplicable Excel crash. I appear to have
exceeded the limits of an Excel memory heap.

Any tips on how to test for/prevent a crash, on how to free Excel memory in
this case?

XLOPER xRes;
for ( int i = 1; i <= 1000; i++ )
{
// open file read only
int res = Excel(xlcOpen, &xRes, 3, TempStr(" workbook.xls"),
TempNum(0), TempBool(TRUE) );
xRes.xltype |= xlbitXLFree;
Excel( xlFree, 0, 1, (LPXLOPER) &xRes );
// close file
Excel(xlcClose, &xRes, 1, (LPXLOPER)TempBool(FALSE));
}



All times are GMT +1. The time now is 05:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com