View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Seymour Seymour is offline
external usenet poster
 
Posts: 5
Default 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));
}