whitecloud1 said:
I'm using the early version of Excel (Office X for Mac)
Is it possible to "set preferences" for the Excel window in Ofice X so
that it remembers (when opening files or "new from template') the
exact same location and dimensions of the window containing the data?
I'm using a 12" Powerbook and need to Maximize the visible window and
get it to lock to the top left corner of the screen, i.e. below the
toolbars.
By default, MacOS will open windows at the size and location they were
at when they were closed last. However, you can bypass that.
For "new from template", create a default template with the size and
location you want (see "Create a template for workbooks or worksheets"
in XL Help).
For all workbooks, you can create a class event to resize and reposition
your windows. In my startup add-in (which could be your Personal Macro
Workbook), I create a class module named WindowHandler, and put the
following code in it:
Public WithEvents oApp As Application
Private Const gWindowDefaultTop As Long = 1
Private Const gWindowDefaultLeft As Long = 1
Private Const gWindowDefaultVMargin As Long = 30
Private Const gWindowDefaultHMargin As Long = 200
Private Const gWindowDefaultZoom As Long = 100
Private Sub oApp_WorkbookOpen(ByVal Wb As Excel.Workbook)
SetWindows Wb
End Sub
Private Sub Class_Initialize()
Set oApp = Application
End Sub
Public Sub SetWindows(ByVal wbBook As Excel.Workbook)
Dim wnWindow As Window
For Each wnWindow In wbBook.Windows
With wnWindow
.Top = gWindowDefaultTop
.Left = gWindowDefaultLeft
.Height = oApp.UsableHeight - gWindowDefaultVMargin
.Width = oApp.UsableWidth - gWindowDefaultHMargin
.Zoom = gWindowDefaultZoom
End With
Next wnWindow
End Sub
In a regular code module in the startup add-in I put
Public clsMyWindow As WindowHandler
And in the ThisWorkbook code module of the startup add-in I put:
Private Sub Workbook_Open()
Set clsMyWindow = New WindowHandler
End Sub
The SetWindows sub, which is fired any time a workbook is opened
(whether a new workbook or an existing file), moves the files window(s)
to the top left position, and resizes it, leaving a small margin at the
right and bottom.