Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Freeze panes on multiple sheets

Author  Topic 

sqlbug76
Starting Member

2 Posts

Posted - 2012-10-18 : 11:01:29
Hello,

I'm new to sql server programming and need some help. I'm trying to freeze panes accross multiple tabs in a workbook, but can't seem to get my code working. The code I have below is only freezing the header row for the first worksheet. Any help with this is greatly appreciated as I have been struggling with this for some time.

-- Freeze Header

IF @lint_hr=0
BEGIN
SELECT @lvch_strErrorMessage='formatting the freeze header '
, @lint_objErrorObject=@lint_objExcel
, @lvch_command='Application.ActiveWorkbook.Sheets('+LTRIM(STR(@lint_NumberOfWorksheets))+').Rows("1:'+ LTRIM(STR(1))+'").Application.ActiveWindow.SplitColumn'
EXEC @lint_hr=sp_OASetProperty @lint_objExcel, @lvch_command, 0
END


IF @lint_hr=0
BEGIN
SELECT @lvch_strErrorMessage='formatting the freeze header '
, @lint_objErrorObject=@lint_objExcel
, @lvch_command='Application.ActiveWorkbook.Sheets('+LTRIM(STR(@lint_NumberOfWorksheets))+').Rows("1:'+ LTRIM(STR(1))+'").Application.ActiveWindow.SplitRow'
EXEC @lint_hr=sp_OASetProperty @lint_objExcel, @lvch_command, 1
END


IF @lint_hr=0
BEGIN
SELECT @lvch_strErrorMessage='formatting the freeze header '
, @lint_objErrorObject=@lint_objExcel
, @lvch_command='Application.ActiveWorkbook.Sheets('+LTRIM(STR(@lint_NumberOfWorksheets))+')Rows("1:'+ LTRIM(STR(1))+'").Application.ActiveWindow.FreezePanes'
EXEC @lint_hr=sp_OASetProperty @lint_objExcel, @lvch_command, 1
END
   

- Advertisement -