Solved

ActiveX excel object - freeze panes

Posted on 2007-04-06
7
1,471 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 143

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 143

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 143

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

717 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