Printable Version of Topic

Click here to view this topic in its original format

UtterAccess Forums _ Microsoft Excel _ Excel.2016 Freezepanes Does Not Work

Posted by: pacala_ba Sep 19 2019, 04:11 AM

Hi
it looks like Excel.2016 FreezePanes , needs ActiveWindow iconfused.gif

It works on EXCEL.2013..........OK

CODE
If ObjXL.ActiveWindow.FreezePanes Then ObjXL.ActiveWindow.FreezePanes = False
objWST.ROWS(nRow & ":" & nRow).Select
'---------------------------------------------
ObjXL.ActiveWindow.FreezePanes = True
' ERR =  1004,Unable to set the FreezePanes property of the Window class...!

Also SET_FOREGROUNDWINDOW (if PC locked) , the same Error
/////////
..there is missing Office 2016.....in this Window.Version lightbulb.gif

Posted by: DanielPineault Sep 19 2019, 08:05 AM

I've always done something along the lines of

CODE
            oExcelWrSht.Rows("2:2").Select
            With oExcel.ActiveWindow
                .SplitColumn = 0
                .SplitRow = 1
                .FreezePanes = True
            End With

Posted by: ADezii Sep 19 2019, 10:11 AM

The following basic Code, using Late Binding should work in that it will set the FreezePanes Property = True on WorkSheet Sheet1 in the Workbook C:\Test\Book1.xlsx:

CODE
'Use Late Binding
Dim oExcel As Object
Dim oWkb As Object
Dim oWks As Object

Set oExcel = CreateObject("Excel.Application")
    oExcel.Visible = True

Set oWkb = oExcel.Workbooks.Open("C:\Test\Book1.xlsx")
Set oWks = oWkb.Worksheets("Sheet1")
    oWks.Activate

oExcel.ActiveWindow.FreezePanes = True

Posted by: pacala_ba Sep 20 2019, 10:36 AM

Hi, thx
I am using ACCESS.Automation not Excel direkt
it only works ,............. if i set WorkSheet.Hwnd to the Foreground, yayhandclap.gif
otherwise allways error ooo.gif

Posted by: pacala_ba Sep 24 2019, 05:50 AM

Hi
https://social.msdn.microsoft.com/Forums/en-US/7e6ff1ed-b4c6-4c75-82be-14175f44df55/freezepanes-throws-an-exception-when-excel-is-minimized?forum=exceldev
pullhair.gif pullhair.gif pullhair.gif

Posted by: arnelgp Sep 24 2019, 06:45 AM

if Activewindow is not the workbook you want to work on,
then it will fail.

objXL.Windows("the name of workbook").Activate
If ObjXL.ActiveWindow.FreezePanes Then ObjXL.ActiveWindow.FreezePanes = False
objWST.ROWS(nRow & ":" & nRow).Select

Posted by: pacala_ba Oct 1 2019, 06:06 AM

Hi, thx , but..

CODE
if Activewindow is not the workbook you want to work on,
then it will fail.

objXL.Windows("the name of workbook").Activate
If ObjXL.ActiveWindow.FreezePanes Then ObjXL.ActiveWindow.FreezePanes = False
objWST.ROWS(nRow & ":" & nRow).Select


XL.2010 OK,
but XL.2016........FAILURE, MICROSOFT BUG pullhair.gif
CODE
ERR =  1004,Unable to set the FreezePanes property of the Window class