Please help compilC# Excel integration code

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
deoyagyaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

wdosanjosCommented:
What error message do you get and in what line?
0
Éric MoreauSenior .Net ConsultantCommented:
And which edition of VS are you using? I don't think the express edition can use it.
0
deoyagyaAuthor Commented:
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
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Todd GerbertIT ConsultantCommented:
That's a mal-formed statement - you're passing a backslash as the last parameter, which is not valid.
0
deoyagyaAuthor Commented:
Can you give me the working code then.
0
wdosanjosCommented:
Try this:

oCommandBar = oExcel.CommandBars.Add("VBAMacroCommandBar",oMissing, oMissing,);
0
wdosanjosCommented:
Sorry I meant,

oCommandBar = oExcel.CommandBars.Add("VBAMacroCommandBar",oMissing, oMissing);
0
deoyagyaAuthor Commented:
I tried this. But this is not working. I am getting the error message "Add method takes three arguments".
0
wdosanjosCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
deoyagyaAuthor Commented:
Thanks a lot for the help. This is working fine now.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.