472,328 Members | 2,126 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 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 15253
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...
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...
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: ...
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...
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...
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...
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...
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...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
1
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...

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.