Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Leftover Workbooks Named "Object" When Opening Excel In IE

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_WorkbookO penEventHandler(excelApp_WorkbookOpen);
}

// I added the empty event handler
private void excelApp_WorkbookOpen(Microsoft.Office.Interop.Exc el.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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Leftover Workbooks with Opening Excel in IE Browser Window Drew Lettington Excel Programming 0 May 24th 06 08:03 PM
What is Error "Method "Paste" of object "_Worksheet" failed? vat Excel Programming 7 February 17th 06 08:05 PM
use variable in Workbooks("book1").Worksheets("sheet1").Range("a1" Luc[_3_] Excel Programming 2 September 28th 05 08:37 PM
Adding named range gives error "method range of object _Global failed " Gunnar Johansson Excel Programming 3 August 10th 04 01:54 PM
METHOD "SELECT" OF OBJECT '_WORKSHEET' FAILED when opening a file Mat Excel Programming 0 July 8th 04 05:13 PM


All times are GMT +1. The time now is 09:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"