473,662 Members | 2,596 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Excel 'freeze panes' from Access VBA code

20 New Member
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 15444
jasperz01
20 New Member
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 Recognized Expert Expert
ActiveWindow.Fr eezePanes = True
Jun 26 '07 #3
jasperz01
20 New Member
ActiveWindow.Fr eezePanes = 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 Recognized Expert Expert
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
jasperz01
20 New Member
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
9580
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 some formatting is applied and the worksheet is saved. I need to know how to freeze panes in my VB program before the worksheet is saved so when the saved worksheet is opened, the column headings in the third row are not scrolled out of view when...
3
2995
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 the users have the ability to export to Excel using forms and buttons, using vba code I write. I have attempted using the DoCmd.TransferSpreadsheet option, but it does not look formatted the way the "Analyze It with MS Excel" button does. To...
4
18238
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", "D:\Test.xls", True
2
4358
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
3692
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 for the top header row, but I want to also freeze the panes. Does anyone know of a way to program the WorksheetOptions information? Below is a sample of what I would like the result to be. I got this result by freezing the panes in Excel and...
7
2940
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 Panes" concept.How to implement this concept in a web page.If any body have the code or good resource please send me. Thanks in Advance
8
2454
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 & email .xls files for users. these are not reports, but rather more like forms. its a pretty simple doc, two worksheets -- the first is basic info common to all recepients. the second is a simple data table that, depending on the recepient, contains...
3
6241
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 that multiple worksheet data in different table.How can i do it.Below is my xml file. <?xml version="1.0"?> <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" ...
3
5390
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 that multiple worksheet data in different table.How can i do it.Below is my xml file. <?xml version="1.0"?> <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office"...
0
8435
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8857
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8768
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8547
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7368
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4181
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4348
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1754
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.