Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Freezing Panes in Excel from Access 1

Status
Not open for further replies.

smgeorge99

Programmer
Jun 6, 2003
21
US
I have an Access database that contains code to generate Excel Workbooks/Sheets using information contained in the database. The generated spreadsheets have various formatting and protection features enabled. But what I can't figure out is how to freeze the panes in Excel from within the Access code while the workbook is being generated. The users of the spreadsheet would like to be able to scroll through the page while the row & column headers remain visible.

The only property that seems to be even remotely close to what I'm trying to do is the Worksheet.ScrollArea property, but that doens't seem to do what I want.

Any help would be greatly appreciated.

Sean
 
Hi, this is an example of how to freeze the panes...

Dim appExcel As New Excel.Application
Dim strPath As String

'set workbook path

strPath = "C:\Test\Test.xls"

With appExcel

'open excel and make application visible
.Visible = True

'Open workbook "C:\Test\Test.xls"
.Workbooks.Open strPath

'move to cell where you wish to freeze the panes
.Range("B2").Select

'freeze panes
.ActiveWindow.FreezePanes = True

'Save workbook
.ActiveWorkbook.Save

'Quit excel
.Quit

End With

Set appExcel = Nothing

Hope this helps.



There are two ways to write error-free programs; only the third one works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top