Home > Development > Excel COM Interop and Freeze Panes

Excel COM Interop and Freeze Panes


This took me so long to get working. The code below sets the freeze pane on a sheet to the 2nd column. Hope this helps someone.

        private void SetupFreezePaneForSheet(_Worksheet sheet)
        {
            sheet.Activate();
            sheet.Application.ActiveWindow.SplitColumn = 2;
            sheet.Application.ActiveWindow.FreezePanes = true;
        }
Advertisements
Categories: Development Tags: , ,
  1. August 21, 2010 at 8:52 pm

    You just saved me so much time with this trying to figure out how to freeze a pane in a worksheet. Thanks,

    Kevin

  2. Scott
    September 15, 2010 at 8:08 pm

    Trying to freeze a single row was driving me nuts! It wasn’t until I discovered your tip that I knew what I was missing. Many thanks for sharing this!

  3. October 14, 2010 at 2:08 pm

    Thanks for the help. You saved me from having to figure this one out myself. I love it when people do that, because I’m lazy.

  4. Barry Novak
    January 6, 2011 at 9:23 pm

    Many thanks from me too. Tried to do it the right way (i.e. looking at the MS-help files), but got nowhere.

  5. pratibha
    February 8, 2011 at 12:52 pm

    thank u it has worked perfectlyyyyyyyy.thank uuuuuuuuuuuuuu

  1. January 2, 2011 at 11:22 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: