[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

ActiveX excel object - freeze panes

Posted on 2007-04-06
7
Medium Priority
?
1,503 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 2000 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
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

650 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