Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
kdw kdw is offline
external usenet poster
 
Posts: 13
Default Freeze pane Prob & Activewindow

I am trying to freeze the pane of a workbook from an Export function in
another program using:

ActiveWindow.FreezePanes = True

This work fine for the first export. Subsequent export would not work. It
would end up freezing the pane if the first workbook, or worse, if the first
workbook was close, an error.

I found that Activewindow still refers to the first workbook, even if I
Activate the sheet/new workbook.

Any ideas? Is there a way to reset the Activewindow property for sure?

Thanks,
kdw

  #2   Report Post  
Posted to microsoft.public.excel.programming
kdw kdw is offline
external usenet poster
 
Posts: 13
Default Freeze pane Prob & Activewindow

This doesn't quite change my issue of the Activewindow property pointing to
the wrong workbook. Perhaps I didn't explain my situation clearly.

My ExportToExcel procedure is written in VB in a non-Office program. After
exporting the data to Excel, I want to freeze the pane before exiting with
something like:

objXLSheet.Activate
objXLSheet.Range("E3").Select
ActiveWindow.FreezePanes = True

Set objXLSheet = Nothing
Set objXLBook = Nothing
Set objXLApp = Nothing

This works on the first export. The second time I call this procedure no
pane is frozen on the second workbook. If I close the first workbook, the
procedure would fail when I run it again. When I check the Activewindow
property, I found that it still refers to the first workbook no matter what I
do.

Can anyone tell what is my error?
Does not my code above cause objXlSheet to be in the Activewindow?

"Gord Dibben" wrote:

kdw

This might help.

Sub Freeze_Panes()
With ActiveWorkbook
ActiveWindow.SplitRow = 2
ActiveWindow.FreezePanes = True
End With
End Sub


Gord Dibben Excel MVP

On Wed, 19 Jan 2005 12:17:05 -0800, kdw wrote:

I am trying to freeze the pane of a workbook from an Export function in
another program using:

ActiveWindow.FreezePanes = True

This work fine for the first export. Subsequent export would not work. It
would end up freezing the pane if the first workbook, or worse, if the first
workbook was close, an error.

I found that Activewindow still refers to the first workbook, even if I
Activate the sheet/new workbook.

Any ideas? Is there a way to reset the Activewindow property for sure?

Thanks,
kdw



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Freeze pane Prob & Activewindow

Just a heads up. Something doesn't appear to be right Gordon. A workbook
doesn't have an activewindow property. You haven't put periods infront of
ActiveWindow so there is no reason for the With statement. The code
should run fine as written, but again, the With statement is superfluous as
written. I suspect there is a typo here or an omitted statement - just
thought I would bring it to your attention if such is the case.

--
Regards,
Tom Ogilvy

"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
kdw

This might help.

Sub Freeze_Panes()
With ActiveWorkbook
ActiveWindow.SplitRow = 2
ActiveWindow.FreezePanes = True
End With
End Sub


Gord Dibben Excel MVP

On Wed, 19 Jan 2005 12:17:05 -0800, kdw

wrote:

I am trying to freeze the pane of a workbook from an Export function in
another program using:

ActiveWindow.FreezePanes = True

This work fine for the first export. Subsequent export would not work.

It
would end up freezing the pane if the first workbook, or worse, if the

first
workbook was close, an error.

I found that Activewindow still refers to the first workbook, even if I
Activate the sheet/new workbook.

Any ideas? Is there a way to reset the Activewindow property for sure?

Thanks,
kdw




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Freeze pane Prob & Activewindow

Thanks Tom

I had the code kicking around without the With ActiveWorkbook and End With
lines.

I mistakenly thought that adding those lines would point the OP's code to the
ActiveWorkbook instead of the original workbook.

They are superfluous as you say and Sub certainly wouldn't work without the
periods if the workbook did have an activewindow property.

I'm going back to the ToolsOptions section now<g

Gord

On Wed, 19 Jan 2005 18:23:19 -0500, "Tom Ogilvy" wrote:

Just a heads up. Something doesn't appear to be right Gordon. A workbook
doesn't have an activewindow property. You haven't put periods infront of
ActiveWindow so there is no reason for the With statement. The code
should run fine as written, but again, the With statement is superfluous as
written. I suspect there is a typo here or an omitted statement - just
thought I would bring it to your attention if such is the case.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
FREEZE PANE Freeze Pane Excel Discussion (Misc queries) 2 April 9th 09 02:53 AM
freeze pane: freeze from two worksheets? Chris Excel Discussion (Misc queries) 4 May 27th 08 01:17 AM
Freeze pane Marisa Excel Worksheet Functions 3 January 11th 06 11:52 AM
Freeze pane kevin Excel Worksheet Functions 0 January 28th 05 02:05 PM
Freeze pane Joe Excel Programming 2 August 2nd 04 01:27 PM


All times are GMT +1. The time now is 04:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"