?
Solved

Please help compilC# Excel integration code

Posted on 2011-02-22
10
Medium Priority
?
243 Views
Last Modified: 2012-05-11
Dear Friends,

I am not sure what is wrong with the code at the followijng web address, but the code is not compiling with VS 2008. Can someone pleaese look into this?

The code is located at http://support.microsoft.com/kb/303872.

Appreciate your help,

Thanks,
AMita
0
Comment
Question by:deoyagya
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 23

Expert Comment

by:wdosanjos
ID: 34954041
What error message do you get and in what line?
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 34954137
And which edition of VS are you using? I don't think the express edition can use it.
0
 

Author Comment

by:deoyagya
ID: 34955054
I am using Visual Studio 2008. I am getting the error message at the following line of the code:

            oCommandBar = oExcel.CommandBars.Add("VBAMacroCommandBar",oMissing, oMissing,\);

This is giving me error related to new line character.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 33

Expert Comment

by:Todd Gerbert
ID: 34955190
That's a mal-formed statement - you're passing a backslash as the last parameter, which is not valid.
0
 

Author Comment

by:deoyagya
ID: 34955266
Can you give me the working code then.
0
 
LVL 23

Expert Comment

by:wdosanjos
ID: 34955372
Try this:

oCommandBar = oExcel.CommandBars.Add("VBAMacroCommandBar",oMissing, oMissing,);
0
 
LVL 23

Expert Comment

by:wdosanjos
ID: 34955383
Sorry I meant,

oCommandBar = oExcel.CommandBars.Add("VBAMacroCommandBar",oMissing, oMissing);
0
 

Author Comment

by:deoyagya
ID: 34958165
I tried this. But this is not working. I am getting the error message "Add method takes three arguments".
0
 
LVL 23

Accepted Solution

by:
wdosanjos earned 2000 total points
ID: 34958692
Please try the following.  I was able to compile here (VS2008, .NET 3.5, Excel 2007).

oCommandBar = oExcel.CommandBars.Add("VBAMacroCommandBar", oMissing, oMissing, oMissing);
0
 

Author Comment

by:deoyagya
ID: 34959479
Thanks a lot for the help. This is working fine now.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question