Tom Knowlton
asked on
Work with Excel Spreadsheet from within Access
I know how to export a query out to Excel in VBA.
After the spreadsheet is created, I want to programmatically do the following:
1) Create a "Split" (panes) in the spreadsheet. Coordinates would be at cell A4.
2) Freeze the panes.
This would be the equivalent of choosing Window |Split in Excel, positioning the split to cell A4, then choosing Window | Freeze Panes.
After the spreadsheet is created, I want to programmatically do the following:
1) Create a "Split" (panes) in the spreadsheet. Coordinates would be at cell A4.
2) Freeze the panes.
This would be the equivalent of choosing Window |Split in Excel, positioning the split to cell A4, then choosing Window | Freeze Panes.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Something like this: (Make sure your excel library is referenced in your VB editor)
Dim xlapp As Object
Set xlapp = CreateObject("Excel.Applic ation")
Workbooks("c:\BOOK1.XLS"). Worksheets ("Sheet1") .Activate
With ActiveWindow
.SplitColumn = 1
.SplitRow = 2
.Freezepanes = true
End With
Thanks
Jell
Dim xlapp As Object
Set xlapp = CreateObject("Excel.Applic
Workbooks("c:\BOOK1.XLS").
With ActiveWindow
.SplitColumn = 1
.SplitRow = 2
.Freezepanes = true
End With
Thanks
Jell
ASKER
I ended up creating the macro.
ASKER
Dim objExcel As New Excel.Application
objExcel.ActiveWorkbook.Sa ve
objExcel.Workbooks.Open strXLSName
objExcel.Quit
'DOES NOT CLOSE EXCEL!!!
Set objExcel = Nothing
objExcel.ActiveWorkbook.Sa
objExcel.Workbooks.Open strXLSName
objExcel.Quit
'DOES NOT CLOSE EXCEL!!!
Set objExcel = Nothing
ASKER
Thanks!