473,399 Members | 3,603 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

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...)

Thanks for your help.

Cybertof.
Nov 15 '05 #1
1 2796
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.
Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Eric | last post by:
I have the following function which creates buttons on Excel commandbar. The problem i can't get the buttons to hook up to events. For example, if i create four buttons only the fourth one fires...
9
by: DFS | last post by:
Anyone written any code to work with the CommandBar object? I have a custom menubar, with 6 buttons, and up to 3 levels of nested menus, such as: File File | Print (that's 2 levels)
13
by: Rolf | last post by:
I have Office97Pro, Office2000Premium and OfficeXP Pro all installed. I'm creating an Access97 application for another person and need to set a reference to Microsoft Office 8.0 Object Library....
6
by: Steve | last post by:
What would happen if an Access97 database had a reference to Microsoft Office 10 library (but only used Access97 stuff) and it was run on a machine that only had Access97 and correspondingly only...
5
by: Hari Shankar V | last post by:
Dear all I am a windows application developer. I want to add office like command bars, toolbars or menubars in my application. Please tell me which component i need to include to achieve this. i...
3
by: Mike Duncan | last post by:
Helo All - I am working on a good ol Microsoft Word Control for windows forms. I have the control displayed and it sizes and moves but when I start to try and mess with the command bars It freaks...
3
by: ANIL KUMAR | last post by:
dear friends, Please help to create a tool bar in vb.net, that is exactly look like office xp style . looking for a valuable reply
1
by: ns2k | last post by:
I add reference office.dll and Microsoft Office Excel Component to my project and use : --------------------------------------- Dim App As Excel.Application, BarName as String ... Dim Bar As...
0
by: Karel | last post by:
Hi, I have developed a vb.net application to create a mail-merged document by using Automation to word from VB.NET. I added the following reference to the application: Microsoft Office 10.0...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.