Hi,


I'm currently banging my head real hard on a problem with events and named ranges. This project was converted from a working VisualStudio 2008 (.NET 2.0) to VS 2012 (.NET 4.0, because of XP computers lying around). Interop object were upgraded from v11 (Excel 2007) to v14 (Excel 2010), against the very same Excel 2010 application version.

I have many named ranges included in a sheet, and a Workbook_open macro dealing with many stuffs (including creating right-click contextual menu entries, activating sheets etc.)

Opening the file manually using Excel 2010 works fine. But if i open it using Interop, the Workbook_open event doesn't fire, and the many of the named ranges are strangely unavailable. More precisely, I can see the names in Excel Name Manager, I can use them in cell's formulas, but I can't access them via VBA (error 1004). I can't access them using Application.Names("the name"), but I can enumerate the Names collection and found the culprits. I can't delete them (or any other "good" names).

I even tested a blank Excel workbook, with one blank sheet. And a Workbook_open macro giving a "Yay! it works" MsgBox. It works ok when opened manually, but fail silently when Interop-ing. I suppose the two errors (event not firing and messed names) are related. So i'm focusing on the Workbook_open bug.

Ok, I tested with a completly new VS 2012 project, using the same Interop v14 objects and my blank Excel file only containing the following in the ThisWorkbook module

Please Login or Register  to view this content.
and using the following code to open Excel :

Please Login or Register  to view this content.
It opens, but the Workbook_Open event doesn't fire. HEEEEELP !