471,354 Members | 2,060 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Running Excell methods

When I run an Excel method, the C# compiler forces me to fill all the
optional parameters.
It looks like this
Excel.Run("AddSheets",null,null,null,null,null,nul l,null,null,null,null,null,null,null,null,null,nul l,null,null,null,null,null,null,null,null,null,nul l,null,null,null,null);
Originally, the AddSheet macro has no parameters.
This is a ridiculous example, but myWorkbook.SaveAs(excelName) does not work
too.

Jul 21 '05 #1
2 1057
C# does not support optional parameters so you need to supply every
parameter to method.
What is the question?

"gideonrv" <gi******@discussions.microsoft.com> wrote in message
news:5A**********************************@microsof t.com...
When I run an Excel method, the C# compiler forces me to fill all the
optional parameters.
It looks like this:
Excel.Run("AddSheets",null,null,null,null,null,nul l,null,null,null,null,null
,null,null,null,null,null,null,null,null,null,null ,null,null,null,null,null,
null,null,null,null); Originally, the AddSheet macro has no parameters.
This is a ridiculous example, but myWorkbook.SaveAs(excelName) does not work too.

Jul 21 '05 #2
After I posted this question I found an answer: I added a VB project which
serves as an intermediae connection between C# and Excel.

"Lebesgue" wrote:
C# does not support optional parameters so you need to supply every
parameter to method.
What is the question?

"gideonrv" <gi******@discussions.microsoft.com> wrote in message
news:5A**********************************@microsof t.com...
When I run an Excel method, the C# compiler forces me to fill all the
optional parameters.
It looks like this:

Excel.Run("AddSheets",null,null,null,null,null,nul l,null,null,null,null,null
,null,null,null,null,null,null,null,null,null,null ,null,null,null,null,null,
null,null,null,null);
Originally, the AddSheet macro has no parameters.
This is a ridiculous example, but myWorkbook.SaveAs(excelName) does not

work
too.


Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Savas Ates | last post: by
2 posts views Thread by alvis | last post: by
1 post views Thread by Mustafa | last post: by
1 post views Thread by Mustafa | last post: by
2 posts views Thread by Robert Halstead | last post: by
2 posts views Thread by alvis | last post: by
reply views Thread by Delforce | last post: by
reply views Thread by XIAOLAOHU | last post: by

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.