workbook after close event

M

Mousam

Hi All,
I am developing a COM add in in C++ for Excel.

I want to know if there is any way to know that a particular workbook
has been closed. There is an event 'WorkbookBeforeClose' of
application object, but it gets fired before the workbook is going to
close and I can not do my operations in its event handler because its
not sure that workbook will be closed after the 'WorkbookBeforeClose'
event gets fired.

Actually in my add in for some reason I am keeping a collection of all
open workbooks. Idea is that in 'NewWorkbook' event of application
object I add newly added workbook to my collection and when workbook
gets close then deletes the closed workbook from my collection.

Definitely I can not achieve this by deleting the workbook from
collection in 'WorkbookBeforeClose' event as at this point I am not
sure whether the workbook will be closed or not.

Is there any better way to achieve the desired functionality?

looking for some positive response.

Thanks & Regards,
Mousam Dubey
 
J

Jason Lepack

Excel already has a Collection of all open workbooks.

Microsoft.Interop.Excel.Workbooks

Cheers,
Jason Lepack
 
M

Mousam

Excel already has a Collection of all open workbooks.

Microsoft.Interop.Excel.Workbooks

Cheers,
Jason Lepack

Hi Jason,
Thanks for your prompt response.

Yeah I know that Excel already has collection of all open workbooks,
but for some reasons I also want to have the collection of all open
workbooks.

Thanks & Regards,
Mousam Dubey
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top