Capture the close event in office docs

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

Capture the close event in office docs
 
Sean Ram




Posts: 27
Joined: 2013-03-13
I am trying to automatically capture the close event on Word, PowerPoint and Excel file. The problem is that when multiple word documents are opened, it captures this close event on only the latest file open.

How to capture the close event for each document as it is closed?

private void adxWordAppEvents1_DocumentBeforeClose(object sender, ADXHostBeforeActionEventArgs e)
{
Logger.LogDebug("EVENT : Word Document On Close Event");
this.ShutDown();
}

private void adxExcelAppEvents1_WorkbookBeforeClose(object sender, ADXHostBeforeActionEventArgs e)
{
Logger.LogDebug("EVENT : Excel On Close Event");
this.ShutDown();
}


private void adxPowerPointAppEvents1_PresentationBeforeClose(object sender, ADXPowerPointPresentationBeforeCloseEventArgs e)
{
Logger.LogDebug("EVENT : PowerPoint On Close Event");
this.ShutDown();
}
Posted 24 Aug, 2022 13:25:34 Top
Andrei Smolin


Add-in Express team


Posts: 18422
Joined: 2006-05-11
Hello Sean,

Sean Ram writes:
The problem is that when multiple word documents are opened, it captures this close event on only the latest file open.


For me, the event works as expected. I suggest that you comment out the second code line in that event handler to check if the issue occurs due to other parts of your code.

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 25 Aug, 2022 03:09:15 Top