Solved

ActiveX excel object - freeze panes

Posted on 2007-04-06
7
1,420 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
Comment Utility
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
Comment Utility
try
  With Me.Spreadsheet0.Object.Sheets(1)
        .Rows("1:1").Select
        .ActiveWindow.FreezePanes = True
   End With
0
 
LVL 7

Author Comment

by:UniqueData
Comment Utility
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
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
Comment Utility
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
Comment Utility
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]
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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…
It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Familiarize people with the process of utilizing SQL Server stored procedures 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 Micr…
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…

744 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

18 Experts available now in Live!

Get 1:1 Help Now