Freeze Panes

R

Rohit

How can I freeze panes at runtime?
I am using MS Spreadsheet control. I am using following code to activate the
cell and freezing the pane
Spreadsheet1.ActiveCell.Offset(3, 4).Select
Spreadsheet1.ActiveWindow.FreezePanes = True

It seems that cell is getting activated and the first cell of the sheet is
(3,4) cell, so freezing pane is not working here.
Please let me know if anybody has any ideas.

Regards,
Rohit Kumar
 
S

Sharad Naik

Below code Freezes Panes at Row1, Coloumn1:

Sub PaneFreezer()
ThisWorkbook.Sheets("Sheet1").Activate
ActiveWindow.FreezePanes = False 'If previously frozen at, unfreeze
first
ThisWorkbook.ActiveSheet.Cells(2, 2).Select
ActiveWindow.FreezePanes = True
End Sub

Sharad
 
R

Rohit

Thanks.
I am facing problem when i try to freeze at specific column (say second row
and second column). This works sometimes, but didn't always work. It seems
some cell selection problem is there.

Wei-Dong XU said:
Hi Rohit,

I build one sample page for you. When you click one cell in Spreadsheet can
click the "Frees" button, you will find the spreadsheet freezed as the same
in Excel. Click "Un Free" button, it will be switched back to the original
state.

Please feel free to let me know if you have any question.

Best Regards,
Wei-Dong XU (WD)
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no
rights.
 
W

Wei-Dong XU [MSFT]

Hi Rohit,

For this scenario, I'd suggest you can add this two lines of code into the
SetFrees method of my sample.
oss.WorkSheets("Sheet1").Activate();
oss.ActiveSheet.Range("B3").Cells.Select();

This method should be:
function SetFrees()
{
oss.WorkSheets("Sheet1").Activate();
oss.ActiveSheet.Range("B3").Cells.Select();
oss.ActiveWindow.FreezePanes = true;
}

Before we set the freezePanes at the worksheet, we can select the cell and
the FreePanels will be set to Row 2 and Col2.

If your issue remains, could you be so kind to build one repro page for me
so that I can research this issue then? Thanks in advance!

You can email me the file or attached it in this thread (please zip the
file). My email account is: (e-mail address removed)(please remove the
online from the email, which avoids spam)

Please feel free to let me know if you have any question.

Best Regards,
Wei-Dong XU (WD)
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
M

mangesh_yadav

Rohit,

try to unfreeze first and then write your code to freeze again. S
first step is unfreeze, then select required cell, and then freeze.

The reason could be that the cell you are trying to select is hidde
away because of an existing freeze
 
W

Wei-Dong XU [MSFT]

Hi Rohit,

I have tested your page. After rendering, the page freezePanels are set
successfully. My IE is 6.0.3790.0 (windows 2003 enterprise). What is your
IE version and the OS? Thanks in advance! Please ensure that you have
installed all the latest patches via Windows Update.

For your scenario, I'd suggest you can set one Timer to execute the
SetFrees after 500 millisecond after the rendering, which may be one
workaround.

Change the code below from:
//---------------
var oss = document.all.ss;
SetFrees();

function SetNoFrees()
to
var oss = document.all.ss;
window.setTimeout("SetFrees()", 500);

function SetNoFrees()
//---------------

Look forward to your reply!

Best Regards,
Wei-Dong XU (WD)
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
R

Rohit

Thanks a lot. It works after setting the timer.
My IE version is 6.0.2800.1106. Without seting timer, it was not freezing
sometimes.

Thanks,
Rohit Kumar
 
W

Wei-Dong XU [MSFT]

You are welcome! :0)

Best Regards,
Wei-Dong XU (WD)
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Freeze panes 4
Worksheet activation on Opening Workbook 2
VBA Type mismatch error 1
Chartspace & Excel2003 0
Freeze Panes loss 3
Freeze Panes 2
Excel Freeze panes in Excel 3
Freeze Panes 2

Top