Excel WorkbookOpen event not fired

Add-in Express™ Support Service
That's what is more important than anything else

Excel WorkbookOpen event not fired
Excel file open from a client program, in different ways we face different problems. 
Tamas Szabo

Posts: 16
Joined: 2008-07-03
Dear Developers,

We use 7.6.1219 Premium version of Addin Expr. (Delphi7)
We develop an addinmodule supportedapps (Excel, Outlook, Word) and regarding Excel we are having a problem.

There is a client program from which we call an Excel file.
Trying to handle the opening in different ways we face different problems.

1. If we use ExcelApplication.Workbooks.Open(..) then when closing the last document the finalization part of addinmodule runs, but the Excel.exe gets stuck among the processes running in the background. When opening the next file controls of addin are already not visible. Though it will not be disabled it is invisible.

2. In case of calling by ShellExecute the problem is that it neither runs into the WorkbookOpen event of addinmodule. However it runs into the events of addinmodule.

Kind regards,
Posted 18 Jul, 2014 10:11:03 Top
Andrei Smolin

Add-in Express team

Posts: 14294
Joined: 2006-05-11
Hello Tamas,

#1. This is supposedly caused by an unreleased COM object. Please see Why doesn’t Excel quit?.

#2. Different way of starting an Office application may produce different results. This may also depend on the Office version.

In your situation, you cannot assume that the WorkbookOpen event is obligatory: you can start Excel without your add-in and turn it on AFTER a number of workbooks are opened. This means, you also need to handle workbooks in the Workbooks collection; I believe this is how you solve this issue. Aslo note that a workbook opened in a ProtectedViewWindow is not listed in the Workbooks collection. You need to check such a workbook in the ProtectedViewWindows collection: you get a workbook using ProtectedViewWindow.Workbook.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 21 Jul, 2014 09:21:40 Top