Running Excell methods

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gideonrv

    #1

    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("AddS heets",null,nul l,null,null,nul l,null,null,nul l,null,null,nul l,null,null,nul l,null,null,nul l,null,null,nul l,null,null,nul l,null,null,nul l,null,null,nul l,null);
    Originally, the AddSheet macro has no parameters.
    This is a ridiculous example, but myWorkbook.Save As(excelName) does not work
    too.

  • Lebesgue

    #2
    Re: Running Excell methods

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

    "gideonrv" <gideonrv@discu ssions.microsof t.com> wrote in message
    news:5AC47C9B-03CB-4BEF-9EA6-DF9CD3873D1F@mi crosoft.com...[color=blue]
    > When I run an Excel method, the C# compiler forces me to fill all the
    > optional parameters.
    > It looks like this:
    >[/color]
    Excel.Run("AddS heets",null,nul l,null,null,nul l,null,null,nul l,null,null,nul l
    ,null,null,null ,null,null,null ,null,null,null ,null,null,null ,null,null,null ,
    null,null,null, null);[color=blue]
    > Originally, the AddSheet macro has no parameters.
    > This is a ridiculous example, but myWorkbook.Save As(excelName) does not[/color]
    work[color=blue]
    > too.
    >[/color]


    Comment

    • gideonrv

      #3
      Re: Running Excell methods

      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:
      [color=blue]
      > C# does not support optional parameters so you need to supply every
      > parameter to method.
      > What is the question?
      >
      > "gideonrv" <gideonrv@discu ssions.microsof t.com> wrote in message
      > news:5AC47C9B-03CB-4BEF-9EA6-DF9CD3873D1F@mi crosoft.com...[color=green]
      > > When I run an Excel method, the C# compiler forces me to fill all the
      > > optional parameters.
      > > It looks like this:
      > >[/color]
      > Excel.Run("AddS heets",null,nul l,null,null,nul l,null,null,nul l,null,null,nul l
      > ,null,null,null ,null,null,null ,null,null,null ,null,null,null ,null,null,null ,
      > null,null,null, null);[color=green]
      > > Originally, the AddSheet macro has no parameters.
      > > This is a ridiculous example, but myWorkbook.Save As(excelName) does not[/color]
      > work[color=green]
      > > too.
      > >[/color]
      >
      >
      >[/color]

      Comment

      Working...