Solved

ActiveX excel object - freeze panes

Posted on 2007-04-06
7
1,434 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 119

Expert Comment

by:Rey Obrero
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
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

895 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

17 Experts available now in Live!

Get 1:1 Help Now