Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I'm new to this group. From a VB6-Program I create a new workbook with 1 worksheet. After writing the title row I want to set the first column and the first row non-scrollable. This is my actual code in the VB6 program: ws.Range("B2").Select ActiveWindow.FreezePanes = True I tested it, it works. My Question: is there another way to do this WITHOUT selecting the cell first? Doing it with an non-active window? I've searched to no avail, but probably haven't asked the right questions or used the correct terms. (English isn't my first language). TIA, Helmut. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Sub FP() With ActiveWindow .SplitColumn = 0 .SplitRow = 2 .FreezePanes = True End With End Sub "Helmut Meukel" wrote in message ... Hi, I'm new to this group. From a VB6-Program I create a new workbook with 1 worksheet. After writing the title row I want to set the first column and the first row non-scrollable. This is my actual code in the VB6 program: ws.Range("B2").Select ActiveWindow.FreezePanes = True I tested it, it works. My Question: is there another way to do this WITHOUT selecting the cell first? Doing it with an non-active window? I've searched to no avail, but probably haven't asked the right questions or used the correct terms. (English isn't my first language). TIA, Helmut. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Short answer is No!
You can, indeed should, do almost everything in Excel without use of activate or select. However there are just a few things with the Window object you do need to, and what you are trying to do is one of them. If you are using VB6 and automating a hidden instance, there's no need to make the application itself visible. Try this in VBA Sub test() Dim xl As Excel.Application, wb As Excel.Workbook, wn As Excel.Window Set xl = New Application Set wb = xl.Workbooks.Add wb.Worksheets(2).Activate wb.Worksheets(2).Range("D4").Activate xl.Windows(1).FreezePanes = True xl.Visible = True ' might want to do xl.usercontrol = true End Sub There are also one or two settings that can only be set with at least one visible workbook. Regards, Peter T "Helmut Meukel" wrote in message ... Hi, I'm new to this group. From a VB6-Program I create a new workbook with 1 worksheet. After writing the title row I want to set the first column and the first row non-scrollable. This is my actual code in the VB6 program: ws.Range("B2").Select ActiveWindow.FreezePanes = True I tested it, it works. My Question: is there another way to do this WITHOUT selecting the cell first? Doing it with an non-active window? I've searched to no avail, but probably haven't asked the right questions or used the correct terms. (English isn't my first language). TIA, Helmut. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Apr 26, 11:22*pm, "Helmut Meukel" wrote:
Hi, I'm new to this group. From a VB6-Program I create a new workbook with 1 worksheet. After writing the title row I want to set the first column and the first row non-scrollable. This is my actual code in the VB6 program: * * ws.Range("B2").Select * * ActiveWindow.FreezePanes = True I tested it, it works. My Question: is there another way to do this WITHOUT selecting the cell first? Doing it with an non-active window? I've searched to no avail, but probably haven't asked the right questions or used the correct terms. (English isn't my first language). TIA, Helmut. If you want to avoid select for speeding up the code you can use following line application.goto reference:=ws.Range("b2"),scroll:=true |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Selecting "Save As" adds "Copy of" to file name- MS Excel 2007 | Excel Discussion (Misc queries) | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
Why does "Show Formulas" in Excel 2007 lock column alignment | Excel Worksheet Functions | |||
How do I "lock" a column so I can scroll across to another colum | New Users to Excel | |||
How do I "lock" a graphic to a particular cell in Excel? | Excel Worksheet Functions |