Excel automation problem

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

    #1

    Excel automation problem

    During Excel automation in VB one can lock lines for
    scrolling by the following code

    ActiveWindow.Fr eezePanes = True

    what would be the equivalent in c#?

    Is it some way to convert or generate Excel Macron in C#
    rather than in VB?

    Greateful for answers!
    Kalle
  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: Excel automation problem

    Kalle,

    You would use the same property assignment in C#. However, VB makes
    late-binding very easy (which I assume is what you are doing). In C#, it
    would be easier if you placed a reference to the "Microsoft Excel Object
    Library" in your project, and then cast the ActiveWindow instance (which is
    off the Application object you will create) to the appropriate worksheet
    instance.

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - nick(dot)paldin o=at=exisconsul ting<dot>com

    "Kalle" <karl.daggfeldt @neuro.ki.se> wrote in message
    news:1b3401c388 16$8454e4c0$a10 1280a@phx.gbl.. .[color=blue]
    > During Excel automation in VB one can lock lines for
    > scrolling by the following code
    >
    > ActiveWindow.Fr eezePanes = True
    >
    > what would be the equivalent in c#?
    >
    > Is it some way to convert or generate Excel Macron in C#
    > rather than in VB?
    >
    > Greateful for answers!
    > Kalle[/color]


    Comment

    • Kalle

      #3
      Re: Excel automation problem

      Thank you for a quick answer!
      I've got it working now.
      Kalle
      [color=blue]
      >-----Original Message-----
      >Kalle,
      >
      > You would use the same property assignment in C#.[/color]
      However, VB makes[color=blue]
      >late-binding very easy (which I assume is what you are[/color]
      doing). In C#, it[color=blue]
      >would be easier if you placed a reference to[/color]
      the "Microsoft Excel Object[color=blue]
      >Library" in your project, and then cast the ActiveWindow[/color]
      instance (which is[color=blue]
      >off the Application object you will create) to the[/color]
      appropriate worksheet[color=blue]
      >instance.
      >
      > Hope this helps.
      >
      >
      >--
      > - Nicholas Paldino [.NET/C# MVP]
      > - nick(dot)[/color]
      paldino=at=exis consulting<dot> com[color=blue]
      >
      >"Kalle" <karl.daggfeldt @neuro.ki.se> wrote in message
      >news:1b3401c38 816$8454e4c0$a1 01280a@phx.gbl. ..[color=green]
      >> During Excel automation in VB one can lock lines for
      >> scrolling by the following code
      >>
      >> ActiveWindow.Fr eezePanes = True
      >>
      >> what would be the equivalent in c#?
      >>
      >> Is it some way to convert or generate Excel Macron in[/color][/color]
      C#[color=blue][color=green]
      >> rather than in VB?
      >>
      >> Greateful for answers!
      >> Kalle[/color]
      >
      >
      >.
      >[/color]

      Comment

      Working...