473,408 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Excel 'freeze panes' from Access VBA code

Hi,

Is it possible using Office Automation to freeze panes in Excel from Access VBA code? I've been trying some things but can't get it right...

Jasper
Jun 25 '07 #1
5 15416
Noone just yet? Maybe I should clarify myself:

All I want is the upper few (5) rows of my Excel sheet not to scroll when scrolling the sheet. And that with some VBA code from Access, I already got the parts that put my querydata on a sheet...

I didn't think this should be hard to do but now it seems nearly impossible... Please anyone? anywhere? ;)
Jun 25 '07 #2
Killer42
8,435 Expert 8TB
ActiveWindow.FreezePanes = True
Jun 26 '07 #3
ActiveWindow.FreezePanes = True
Yes, tried that, didn't work at first. Got it working now however:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim oApp As New Excel.Application
  3. Dim oBook As Excel.Workbook
  4. Dim oSheet As Excel.Worksheet
  5.  
  6. Set oBook = oApp.Workbooks.Add 'Open a new workbook
  7. Set oSheet = oBook.Worksheets(1) 'with a new sheet
  8. oSheet.PageSetup.Orientation = xlLandscape 'In Landscape for printing purposes
  9. oSheet.PageSetup.Zoom = fnZoomLevel(Name) ' Zoom level for printing
  10. oSheet.Name = fnName(Name) ' Give the sheet the right name (name of grade)
  11.  
  12. oSheet.Range("A4").Select
  13. oApp.ActiveWindow.FreezePanes = True
  14.  
I tried 'ActiveWindow' as a property of oSheet, that didn't work of course ;) You also need to select the right cell before setting the FreezePanes property.
Works like a dream now. Thanks!

Jasper
Jun 26 '07 #4
Killer42
8,435 Expert 8TB
Glad to see you got it working. :)

Sorry, I was at work and in a rush when I posted my response, but thought that would help push you in the right direction. (I just did "record new macro", did a "freeze", stopped and copied the macro.)
Jun 26 '07 #5
Glad to see you got it working. :)

Sorry, I was at work and in a rush when I posted my response, but thought that would help push you in the right direction. (I just did "record new macro", did a "freeze", stopped and copied the macro.)
No Prob!

That's what I tried :) Thanks for the effort,

Jasper
Jun 26 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Dan | last post by:
I have created an Excel worksheet using automation from a VB.NET application. The worksheet is never made visible by the VB program. It is created and filled with data from a database and then...
3
by: user_5701 | last post by:
Hello, I have an Access 2000 database that I need to export certain queries to Excel 2000. The problem is that I have to take the toolbars away from the users for security purposes, but still let...
4
by: sunilkeswani | last post by:
I need help with exporting data from 2 access tables, into 2 existing spreadsheets in a single Excel file. Currently, I am using this code: DoCmd.TransferSpreadsheet acExport, 8, "Table1",...
2
by: jcm | last post by:
I am trying to Automate Office with C#. How can I freeze panes in excel with Microsoft Visual C#? I hope someone can help me with this. Please help !
4
by: Matt | last post by:
I have a web page that reads a dataset, populates a datagrid, and then launches Excel to display the results. I was able to format the results (font, background color ..) and even create a filter...
7
by: srinivas | last post by:
Hi, I am a asp programmer.I am displaying the db records in the html pages in a web page.I have 500 columns and 1000 rows in that html table.Here i am planning to implement the "MS-Excel Freeze...
8
by: matt | last post by:
hello, can anyone speak to some of the common or preferred methods for building Excel .XLS files, programmatically thru the .NET framework? i have an intranet app that needs to generate &...
3
by: sejal17 | last post by:
hello Can any one tell me how to read multiple worksheets from a single excel file.I have stored that excel in xml file.so i want to read that xml that has multiple worksheet.And i want to store...
3
by: sejal17 | last post by:
hello Can any one tell me how to read multiple worksheets from a single excel file.I have stored that excel in xml file.so i want to read that xml that has multiple worksheet.And i want to store...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.