D
Drew Lettington
I'm experiencing a problem when I open a workbook from Internet Explorer (for
example, clicking on a hyperlink to a .xls file) and my system is configured
to open Excel in a brower window. If Excel is opened before I click the link
in IE then when I close the browser window that was displaying the workbook,
an empty workbook named "Object" is left open in Excel. Each time an Excel
link
is opened in IE and then the browser window is closed, additional workbooks
named "Object2", "Object3", ... are left open.
I tracked the issue to a COM add-in (disabling the add-in caused the problem
to go away) and in particular creating an Excel event handler in the add-in.
Note: it doesn't appear to matter which event handler is created and the
handler doesn't even need to contain any code to make the issue appear. Just
defining an event handler in VBA doesn't appear to cause the problem.
Has anyone seen this problem or know anything about how to resolve it?
It's easy to produce the problem by creating a new Office COM add-in using
the Visual Studio .NET 2003 project wizard, then add an event handler:
// I added the reference to Office XP Primary Interop Assembly (PIA) for Excel
using Excel = Microsoft.Office.Interop.Excel;
// This code was generated by the wizard
public void OnConnection(object application, Extensibility.ext_ConnectMode
connectMode, object addInInst, ref System.Array custom)
{
applicationObject = application;
addInInstance = addInInst;
// I added this code
Excel.Application excelApp = (Excel.Application)applicationObject;
excelApp.WorkbookOpen += new
Microsoft.Office.Interop.Excel.AppEvents_WorkbookOpenEventHandler(excelApp_WorkbookOpen);
}
// I added the empty event handler
private void excelApp_WorkbookOpen(Microsoft.Office.Interop.Excel.Workbook Wb)
{
}
If the event handler is in the code then the workbooks are left open. If I
comment out adding the handler to the WorkbookOpen event then they are
closed. I also tried other events and they all caused the issue.
example, clicking on a hyperlink to a .xls file) and my system is configured
to open Excel in a brower window. If Excel is opened before I click the link
in IE then when I close the browser window that was displaying the workbook,
an empty workbook named "Object" is left open in Excel. Each time an Excel
link
is opened in IE and then the browser window is closed, additional workbooks
named "Object2", "Object3", ... are left open.
I tracked the issue to a COM add-in (disabling the add-in caused the problem
to go away) and in particular creating an Excel event handler in the add-in.
Note: it doesn't appear to matter which event handler is created and the
handler doesn't even need to contain any code to make the issue appear. Just
defining an event handler in VBA doesn't appear to cause the problem.
Has anyone seen this problem or know anything about how to resolve it?
It's easy to produce the problem by creating a new Office COM add-in using
the Visual Studio .NET 2003 project wizard, then add an event handler:
// I added the reference to Office XP Primary Interop Assembly (PIA) for Excel
using Excel = Microsoft.Office.Interop.Excel;
// This code was generated by the wizard
public void OnConnection(object application, Extensibility.ext_ConnectMode
connectMode, object addInInst, ref System.Array custom)
{
applicationObject = application;
addInInstance = addInInst;
// I added this code
Excel.Application excelApp = (Excel.Application)applicationObject;
excelApp.WorkbookOpen += new
Microsoft.Office.Interop.Excel.AppEvents_WorkbookOpenEventHandler(excelApp_WorkbookOpen);
}
// I added the empty event handler
private void excelApp_WorkbookOpen(Microsoft.Office.Interop.Excel.Workbook Wb)
{
}
If the event handler is in the code then the workbooks are left open. If I
comment out adding the handler to the WorkbookOpen event then they are
closed. I also tried other events and they all caused the issue.