Activate and Deactivate events for Excel's main window

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

Activate and Deactivate events for Excel's main window
 
tjoubert




Posts: 3
Joined: 2012-01-08
Hi,

I am developing an add-in in Excel 2010. The add-in is required to execute some code when Excel's main window is activated/selected and when it is deactivated (such as in the case when another application is loaded whilst Excel is running and that newly loaded application has focus).

I am unable to find any event in Add-in express' ADXExcelAppEvents component that would allow me to write code to handle these events. There are the WindowActivate and WindowDeactivate events, but these are for the Workbook windows (MDI children of Excel's main window).

I am looking for some assistance with this issue please.

Many thanks and best regards

Terence



[B]
Posted 08 Jan, 2012 11:42:12 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hi Terence,

Unfortunately the Excel Object Model doesn't provide any property or event for this. To get assistance with host applications’ objects, their properties, and methods as well as help info, use the Object Browser. Go to the VBA environment (in the host application, choose menu Tools | Macro | Visual Basic Editor or just press {Alt+F11}), press {F2}, select the host application in the topmost combo and/or specify a search string in the search combo. Select a class /property /method and press {F1} to get the help topic that relates to the object.

As a workaround you can use some Windows API functions to check where the focus resides now.
.NET, Extended MAPI, Windows Phone & RT
Posted 09 Jan, 2012 01:37:07 Top