473,583 Members | 3,010 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_Op en()
{
try
{
MessageBox.Show (ThisApplicatio n.CommandBars.T oString());
MessageBox.Show (ThisApplicatio n.CommandBars.C ount.ToString() );
}
catch (Exception e)
{
MessageBox.Show (e.Message);
}
}

The first MessageBox works well and says
'Microsoft.Offi ce.Core.Command BarsClass'

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.Offic e.Core namespace...)

Thanks for your help.

Cybertof.
Nov 15 '05 #1
1 2810
I have 2 'office' Primary Interop assemblies
office v7.0.3300.0 (c:\windows\Mic rosoft.NET\Fram ework\v1.1.4322
\office.dll
and

Microsoft Office 11.0 Object Library
c:\windows\asse mbly\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
1776
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 the ButtonEvent, the rest do nothing. What am i doing wrong. Please help Eric --------------begin Function-------------------------- def...
9
1980
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
18811
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. When I look at my references, all I have is Microsoft Office 10.0 Object Library. Why don't have Microsoft Office 8.0 Object Library when I have...
6
3386
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 had Microsoft Office 8 library? Would Access97 be smart enough to go to the Microsoft Office 8 library when it needed to? Thanks, Steve
5
2560
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 searched a lot in google but didn't find clearly the answer. Ciao Hari
3
2013
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 out. One I can't even access command bars unless I: namespace Office = Interop::Office; But the the whole IDE crashes when I: Office:: I mean...
3
2713
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
2048
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 Microsoft.Office.Core.CommandBar = App.CommandBars(BarName)
0
1348
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 Object Library In runtime, when I click that button, I open a word doc. I create a commandbar whith in that commandbar a combobox with a list of...
0
7895
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7826
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8182
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8327
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6579
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3818
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3843
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2333
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.