Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Office C# code behin : CommandBar Class Problem ?

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.ToStri ng());
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...)


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Office C# code behin : CommandBar Class Problem ?

I have 2 'office' Primary Interop assemblies


office v7.0.3300.0 (c:\windows\Microsoft.NET\Framework\v1.1.4322
\office.dll


and

Microsoft Office 11.0 Object Library
c:\windows\assembly\GAC\Office\11.0.0.0__7.......\ office.dll



I have reinstalled Office 2003 and now it works when i start a new
'Excel' project.

But, how can i add manually to an existing 'excel' project the good
assembly ?



Thanks.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Any problem of migration for upgrading Office 2007 from Office 200 Eric Excel Discussion (Misc queries) 3 September 6th 07 04:22 PM
Create CommandBar in xl95 code - possible? jamieuk Excel Programming 5 February 9th 04 02:23 PM
Problem Using an Object Variable in a Class Definition Boxman Excel Programming 2 August 28th 03 03:05 AM
Userform with template class module problem Tom Ogilvy Excel Programming 1 July 18th 03 09:15 PM
Userform with template class module problem Tom Ogilvy Excel Programming 0 July 17th 03 06:38 PM


All times are GMT +1. The time now is 10:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"