Cube Analysis Addin and c#
When you open Excel utilizing Automation such as you are doing, addins are
not loaded. This is the cause of your problem. Jim showed you some VBA code
to show how to load an addin using code. You would have to have your code
open excel, then issue commands to load the addin. When you open it
manually, the addin is loaded automatically - again, not the case when you
open Excel as you are doing.
--
Regards,
Tom Ogilvy
"Cricket" wrote:
[i]
Thank you for the tips.
If I clearly understand what are you suggesting than I can say it isnt solve
my problem. If it is help I copy here a little code to show what I am doing
now. (just open the excel) I have writen a little code to set every add-in to
installed, but it didn't help. (If I open the excel from code it cant realize
the formula names...)
exWorkbook = ExcelObj.Workbooks.Open(stFilePath, Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value, Missing.Value);
// exWorkbook = ExcelObj.Workbooks.Open(stFilePath, 0, false, 5, "",
"", true, XlPlatform.xlWindows, "\t", false, false, 0, true, Missing.Value,
Missing.Value);
ExcelObj.EnableEvents = true;
for (int i=1; i<=ExcelObj.AddIns.Count; i++)
{
AddIn ad = ExcelObj.AddIns;
ad.Installed = true;
}
"Jim Thomlinson" wrote:
Try adding this to install the addin to your instance of XL...
AddIns("Functions Class").Installed = True
Note that Cube Analysis has a nasty side effect of disabling events in XL so
after you finish whatever you are doing be sure to reset events.
Application.EnableEvents = True
--
HTH...
Jim Thomlinson
"Cricket" wrote:
Furthermore, If I launch the excel from C# code and change the value of the
cell, than all of the calculated cells got the #NAME? sign because it do not
recognize the function names like CUBECELLMEMBER...
"Cricket" wrote:
Hi!
I have a problem with the Cube analysis add-in.
I have to open an Excel file contains a report from C# code and change a
cell value. The cell witch I want to change is a filter value in the report
and the report is converted to free form.
I have tried to make this in a lot of way and realized finally that the Cube
analysis add-in isn't working. If I open the excel file manually there's
everything good.
Finally I wrote a little code just to open the excel file and see what will
happen if I change the specific value manually in the window that appears. In
this case the report isn't refreshed too.
So my main problem is that If I open the excel file manually there's
everything OK, but if I open the same file from code than the report isn't
refreshing.
Thanks
|