start excel from c# and load add-ins

B

Bob

Hi,
I open excel from C# with the following code. It works fine except
that any Add-Ins on the computer don't load. They show up as checked
in the add-ins box but don't function. To get them to function I have
to unlload (uncheck) then reload them. I have this problem in both
Office XP and Office 2007. Is there some method I can call on the
ExcelObj to get the add-ins to load/work in the first place?



ExcelObj = new Microsoft.Office.Interop.Excel.Application();

Thanks,
Bob
 
B

Bob

Hi,
I open excel from C# with the following code. [...]

Not that your question is really all that on-topic in either the .NET or  
C# newsgroups.  But, if you feel you _must_ post the same question to  
multiple newsgroups, please learn to cross-post properly instead of  
multi-posting your question.

Thanks,
Pete

Sorry, I accidentally posted in the .net framework group and
immediatelly deleted when I saw it was there. I think it is a c#
question, as it is c# code and interacting with office is a pretty
important c# feature.
 
B

Bob

 Your  
question is really an Office automation question, and you should seek out 
a forum specific to that topic if you expect a good answer.


Fair enough. I think I have a rough answer in for future reference:

Microsoft.Office.Interop.Excel.Application ExcelObj = new
Microsoft.Office.Interop.Excel.Application();
int nmAddins=ExcelObj.AddIns.Count;
for (int i=1;i<nmAddins+1;i++){
try
{
AddIn thisAdd = ExcelObj.AddIns.get_Item(i);



thisAdd.Installed = true;

try
{
ExcelObj.Workbooks.Open(fullName,
0,
true,
1,

System.Reflection.Missing.Value,

System.Reflection.Missing.Value,
true,

System.Reflection.Missing.Value,

System.Reflection.Missing.Value,
true,
false,

System.Reflection.Missing.Value,
false,
false,
false);
}
catch (Exception ex2)
{

}

}
catch (Exception ex)
{

}

Thanks,
Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top