NewMoney
06-07-2010, 02:14 PM
I am in need of setting Range("B16") to FreezePanes with VBScript. My primary area of trouble:
Set objExcel = CreateObject("Excel.Application")
Set objRange = objExcel.Range("B16")
objRange.FreezePanes = True
The script in total is just under 1200 lines and I can accomplish formula pastings, any formatting, PageSetup parameters all with very similar code as shown above. Only FreezePanes throws an error.
That error being: Object doesn't support this property or method: 'objRange.FreezePanes'
I have added .Select to the end of my Range and added .ActiveWindows. between the range and freezepanes to no avail. Most all of my Googleing has found that adding .ActiveWindows. should resolve the problem. Unfortunately it does not.
Note I have also tried:
Set objExcel = CreateObject("Excel.Application")
SetObjWorkbook = objExcel.Workbooks.open(d:\test1.xls)
Set objWorksheet1 = objWorkbook.worksheets(1)
Set objRange = objworksheet1.Rows("16:16").Active
objRange.ActiveWindow.FreezePanes = True
Which Produces ERROR: Object doesn't support this property or method: 'objWorksheet1.Rows(...).Active'
Removing .Active produces ERROR: Object doesn't support this property or method: 'objRange.ActiveWindow'
And Removing .ActiveWindow produces: Object doesn't support this property or method: 'objRange.FreezePanes'
Your help would be greatly appreciated.
Set objExcel = CreateObject("Excel.Application")
Set objRange = objExcel.Range("B16")
objRange.FreezePanes = True
The script in total is just under 1200 lines and I can accomplish formula pastings, any formatting, PageSetup parameters all with very similar code as shown above. Only FreezePanes throws an error.
That error being: Object doesn't support this property or method: 'objRange.FreezePanes'
I have added .Select to the end of my Range and added .ActiveWindows. between the range and freezepanes to no avail. Most all of my Googleing has found that adding .ActiveWindows. should resolve the problem. Unfortunately it does not.
Note I have also tried:
Set objExcel = CreateObject("Excel.Application")
SetObjWorkbook = objExcel.Workbooks.open(d:\test1.xls)
Set objWorksheet1 = objWorkbook.worksheets(1)
Set objRange = objworksheet1.Rows("16:16").Active
objRange.ActiveWindow.FreezePanes = True
Which Produces ERROR: Object doesn't support this property or method: 'objWorksheet1.Rows(...).Active'
Removing .Active produces ERROR: Object doesn't support this property or method: 'objRange.ActiveWindow'
And Removing .ActiveWindow produces: Object doesn't support this property or method: 'objRange.FreezePanes'
Your help would be greatly appreciated.