Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting when a user closes Excel (OLE question)

Status
Not open for further replies.

howardb1

IS-IT--Management
Jun 1, 2001
6
US
I have a program that opens an Excel 2000 spreadsheet, reads several columns, then queries an oracle database using the values in each row of the columns to retrieve additional information, which I then write to a new worksheet in the workbook. This all works fine except that I allow the user to select the worksheet and columns interactively in Excel and the user sometimes closes the workbook while Excel, which crashes my program. I'd like to use the OnBeforeClose event to block the closure, or at least verify that they want to really do this and then handle the disconnect gracefully. Unfortunately, when I try using even the simplest event handler, i.e., "int I; I = 1;" in the event method body, the program crashes with a cpu dump when Excel is closed.

I'm running BCBv6 sp2 and I'm using the TExcelApplication component to access Excel 2000.

Anyone know how to do this or something like this another way?

Ron Brown
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top