Solved

ActiveX excel object - freeze panes

Posted on 2007-04-06
7
1,441 Views
Last Modified: 2011-09-20
I have an ActiveX spreadsheet object on an Access form.
I want to freeze the panes but can't find the right syntax for the object
Here's what I have now...
'---------------------------------------
Function CleanUpSheet(intRowNum As Integer, intColNum As Integer)
   
    With Me.Spreadsheet0.Object.Sheets(1)
        .Columns.AutoFit
        .Range(.Cells(4, 1), .Cells(intRowNum, intColNum)).Sort
        .Range("C4").Select
        .FreezePanes = True
    End With
       
End Function
'---------------------------------------


I get an error on the .FreezePanes=True ('object doesn't support this property or method')
I know in Excel VBA the command is 'ActiveWindow.FreezePanes = True' and I have tried a few different ways.

Thanks in advance,

Michael
0
Comment
Question by:UniqueData
  • 3
  • 3
7 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 18867896
Function CleanUpSheet(intRowNum As Integer, intColNum As Integer)
   
    With Me.Spreadsheet0.Object.Sheets(1)
        .Columns.AutoFit
        .Range(.Cells(4, 1), .Cells(intRowNum, intColNum)).Sort
        .Range("C4").Select
    End With
    ActiveWindow.FreezePanes        
End Function

or:

Function CleanUpSheet(intRowNum As Integer, intColNum As Integer)
   
    With Me.Spreadsheet0.Object.Sheets(1)
        .Columns.AutoFit
        .Range(.Cells(4, 1), .Cells(intRowNum, intColNum)).Sort
        .Range("C4").Select
        .Parent.Windows(1).FreezePanes        
    End With
   
End Function


0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 18867959
try
  With Me.Spreadsheet0.Object.Sheets(1)
        .Rows("1:1").Select
        .ActiveWindow.FreezePanes = True
   End With
0
 
LVL 7

Author Comment

by:UniqueData
ID: 18868025
active window (with or without the dot didn't work)
.Parent worked perfectly.

What is the best way to find the correct syntax for this activeX controls?  Now I am wanting to change line styles and can't find the correct properties.
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 18868049
the simplest way is to use the macro recorder.
start it, do the 2-3 things you want to format, stop the recorder, and look at the generated code.
will help you alot to find the objects to use (although the code as such is mostly unusable)
0
 
LVL 7

Author Comment

by:UniqueData
ID: 18868077
This works within excel, but the code doesn't exactly match in Access when refering to the activeX control (such as the ActiveWindow that had issues).

I need to be able to copy and paste sheets, change cell's background colors, etc.  I can do it fine directly in Excel, but in this case I need to keep things in the Access form and the activeX references/syntax are different
0
 
LVL 7

Author Comment

by:UniqueData
ID: 18877411
Angel,

the .Parent worked.  Is there somewhere I can see other Properties of the object so I can better learn how to handle my other formatting needs?

Michael
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 18878259
in office products (ie excel, word), open the vba editor, and use the Object browser (F2).
using the search command, you can find the object / methods ... quite easily.
with a bit of intuition + macro recorder to get an idea, most stuff can be solved like that.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now