M
Meteor
Using VS2005, I have written an Excel add-in, firstly using VSTO, then
later, (when I ran into problem after problem), as a shared add-in
using Interop.Excel.
The add-in runs fine on my development machine, however when deployed
to any other machine, it won't run. I commented out all the variable
declarations, and put in MessageBox.Show() alerts to find out where
the code is stopping.
Using that method, I found out that the problem occurs when I try to
reference the CommandBars collection of the Application
(Microsoft.Office.Interop.Excel.Application) object. No amount of try
catch will display any error, and the add-in will just stop running at
that line. I can get a reference to the CommandBars collection using
'object bars = Application.CommandBars as object', but as soon as I
try to do anything with the resulting object, the add-in silently
exits again. If I use
"MessageBox.Show('Application.CommandBars.Count') or something
similar, I have no luck.
I need the reference to the CommandBars collection so that I can add a
new menu item.
Incidentally, as the add-in is loaded on startup, I can't figure out
how you could possibly debug it - you can't attach to the remote Excel
process until after the add-in has failed - can you? Being a COM add-
in, it doesn't appear in the list of available add-ins, so how could
you ever load it after Excel is running?
Can anyone offer a suggestion?
Thanks in advance
later, (when I ran into problem after problem), as a shared add-in
using Interop.Excel.
The add-in runs fine on my development machine, however when deployed
to any other machine, it won't run. I commented out all the variable
declarations, and put in MessageBox.Show() alerts to find out where
the code is stopping.
Using that method, I found out that the problem occurs when I try to
reference the CommandBars collection of the Application
(Microsoft.Office.Interop.Excel.Application) object. No amount of try
catch will display any error, and the add-in will just stop running at
that line. I can get a reference to the CommandBars collection using
'object bars = Application.CommandBars as object', but as soon as I
try to do anything with the resulting object, the add-in silently
exits again. If I use
"MessageBox.Show('Application.CommandBars.Count') or something
similar, I have no luck.
I need the reference to the CommandBars collection so that I can add a
new menu item.
Incidentally, as the add-in is loaded on startup, I can't figure out
how you could possibly debug it - you can't attach to the remote Excel
process until after the add-in has failed - can you? Being a COM add-
in, it doesn't appear in the list of available add-ins, so how could
you ever load it after Excel is running?
Can anyone offer a suggestion?
Thanks in advance