LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Confusion about how the Window object fits into the Excel object model

Hi Josh,

This might give an idea of what's going on:

Sub Test()
Dim i As Long
Dim wb As Workbook
Dim ws As Worksheet
Dim w As Window

Set wb = Workbooks.Add
Set w = wb.NewWindow

wb.Windows(1).DisplayGridlines = False

wb.Windows(2).Activate
wb.Worksheets(2).Activate
wb.Windows(1).DisplayGridlines = False

'ThisWorkbook.Activate
wb.Windows(2).Activate
For i = 1 To 2
wb.Windows(i).Activate
For Each ws In wb.Worksheets
ws.Activate
Debug.Print wb.ActiveSheet.Name, _
"Window-" & i, wb.Windows(1).DisplayGridlines
Next
Debug.Print
Next

End Sub

You should find you can apply different settings to the same sheet in
different windows.
Note Window(1) is the active window of the WB, regardless of how many
windows it has or if the WB itself is active.

But there's something rather strange about the WB/Windows collection, eg
it's possible to run two different customized palettes in the same WB
(there's a bit of a nack to doing that ! ).

Regards,
Peter T

"Josh Sale" <jsale@tril dot cod wrote in message
...
I'm a bit confused about how the Window object fits into the Excel object
model and am hoping somebody can set me straight. Here's my deal ...

My application wants to create a new worksheet and have its gridlines and
headings be set the same as another worksheet in a different workbook. I
understand that the DisplayGridlines and DisplayHeadings properties are

part
of the Window object and not the worksheet object. In fact if you search
through all of the properties of a workbook and its constituent parts you
can't find anything that controls these two apparent aspects of the
worksheet.

Yet, if you go to Tools | Options and check or uncheck these properties to
change the appearance of the currently active worksheet, save the workbook
(which presumably doesn't save the active window) and then reopen the
workbook, the gridlines and headings are restored to their state at the

time
of the save.

So presumably, these properties of the window are being saved with the
workbook? But where? What am I missing?

It bugs me to have this gap in my mental model of how Excel is strung
together. Again I hope somebody will set me straight on how this hangs
together.

TIA,

josh




 
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
Excel 2002 Object Model Hiep Excel Programming 2 March 25th 05 12:41 AM
Excel 2003 object model Jim Excel Programming 0 October 8th 04 07:03 PM
Excel object model Alan Hutchins Excel Programming 0 September 17th 04 11:32 AM
Docs for Excel object model with p/e/m Erv Young Excel Programming 2 January 15th 04 03:11 AM
Subtotals in Excel object model Josh Sale[_2_] Excel Programming 5 October 24th 03 04:28 PM


All times are GMT +1. The time now is 11:11 AM.

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

About Us

"It's about Microsoft Excel"