Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
FREEZE PANE | Excel Discussion (Misc queries) | |||
freeze pane: freeze from two worksheets? | Excel Discussion (Misc queries) | |||
Freeze pane | Excel Worksheet Functions | |||
Freeze pane | Excel Worksheet Functions | |||
Freeze pane | Excel Programming |