Freeze Panes from Access

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
1,715
I'm building a Excel Workbook from Access after setting a new Excel.Application.

Set ws= objExcelApp.Workbooks.Open(Myfile).Sheets(1)

With this I am able to use methods ws.cells, ws.columns etc.

I would like to freeze the top row of sheets(1) but haven't been able to figure it out.
In Excel this would be
Code:
Range("A2").Select
ActiveWindow.FreezePanes= true

I am able to select the range of my Excel object, but would need some other way to FreezePanes.
Does anyone know if this is possible ?
 

Some videos you may like

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,271
Office Version
  1. 365
Platform
  1. Windows
Have you tried using objExcelApp?
Code:
objExcelApp.ActiveWindow.FreezePanes = True

PS You should probably use objExcelApp to select the cell and include worksheet/workbook references.
 

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
1,715
Many thanks Norie that did it nicely. Not sure if I'm using objExcelApp as you suggest. I have
Code:
 Set objExcelApp = CreateObject("Excel.Application")
 Set wb = objExcelApp.Workbooks.Open(Fullpath & Me.Code & ".xlsx")
 Set ws = wb.Sheets(1)
 With ws
...
 

Watch MrExcel Video

Forum statistics

Threads
1,127,505
Messages
5,625,199
Members
416,080
Latest member
blemon

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top