C
cybertof
Hello,
Could you please tell me what's wrong with this code
(c# office code behind) :
protected void ThisWorkbook_Open()
{
try
{
MessageBox.Show(ThisApplication.CommandBars.ToString());
MessageBox.Show(ThisApplication.CommandBars.Count.ToString());
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}
The first MessageBox works well and says
'Microsoft.Office.Core.CommandBarsClass'
But the 2nd MessageBox fails in
'Object Reference not set to an instance of an Object'
How to get number of command bars ?
Note :
When you create a new 'Excel C#' project,
is it normal that the wizard ommits the 'office' reference
(which include the Microsoft.Office.Core namespace...)
Could you please tell me what's wrong with this code
(c# office code behind) :
protected void ThisWorkbook_Open()
{
try
{
MessageBox.Show(ThisApplication.CommandBars.ToString());
MessageBox.Show(ThisApplication.CommandBars.Count.ToString());
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}
The first MessageBox works well and says
'Microsoft.Office.Core.CommandBarsClass'
But the 2nd MessageBox fails in
'Object Reference not set to an instance of an Object'
How to get number of command bars ?
Note :
When you create a new 'Excel C#' project,
is it normal that the wizard ommits the 'office' reference
(which include the Microsoft.Office.Core namespace...)