Hi
How do I set the default zoom to 90% rather than 100%?
I have a high resolution monitor, and have set the MS Windows 2000
text size to large. But in excel it is slightly too large and I keep needing
to zoom out... Or is there a setting to change the screen DPI or
something...?!
Any suggestions?
Ship
Shiperton Henethe
Public WithEvents oApp As Application
Private Sub oApp_WorkbookOpen(ByVal Wb As Excel.Workbook)
With ActiveWindow
.Top = 1
.Left = 1
.Zoom = 100
End With
End Sub
Private Sub Class_Initialize()
Set oApp = Application
End Sub
with this in a regular code module:
Dim clsMyWindow As MyWindowClass
Public Sub Setup_Windows()
Set clsMyWindow = New MyWindowClass
End Sub
and in the ThisWorkbook code module:
Private Sub Workbook_Open()
Setup_Windows
End Sub
This sets the windows of all workbooks that open after the startup
add-in to open in the upper left corner, with a zoom of 100%. Change the
zoom to suit.
In article <418b5294$0$10426$afc3...@news.easynet.co.uk>,
> In my startup add-in, I have a class module, "MyWindowClass" with the
> following code (among other events):
What is this?
And where do I find it?
Is it something to do with REGIT..?
Confused. Nervously,
Ship
Shiperton Henethe
It all goes into the spot that VBA code goes into.
Start a new workbook.
Hit alt-f11 (to get to the VBE where macros live)
hit ctrl-r to see the project explorer (like windows explorer)
Select your project
It should look like:
VBAProject (book1)
Do Insert|module (from the toolbar at the top).
Paste this into the new code window:
Option Explicit
Dim clsMyWindow As myWindowClass
Public Sub Setup_Windows()
Set clsMyWindow = New myWindowClass
End Sub
Now do Insert|Class module and paste this into the new code window:
Option Explicit
Public WithEvents oApp As Application
Private Sub oApp_WorkbookOpen(ByVal Wb As Excel.Workbook)
Dim myWindow As Window
For Each myWindow In Wb.Windows
myWindow.Zoom = 90
Next myWindow
End Sub
Private Sub Class_Initialize()
Set oApp = Application
End Sub
(I made a minor change to J.E.'s code. He can yell at me later <vbg>.)
And then hit F4 (to see the properties dialog)
In the (name) field, type:
myWindowClass
and hit enter.
Now find the ThisWorkbook Module (you'll have to expand the levels in that
project explorer!)
double click on it and paste this into that new code window:
Option Explicit
Private Sub Workbook_Open()
Setup_Windows
End Sub
Now back to excel and file|saveAs.
But choose Addin from the bottom of that "save as type" box.
Point at the folder you want to save this to (and remember where you saved it!).
Now, you're ready to make it available each time you start excel.
Tools|addins|browse for that folder and for that addin you just saved.
tada! You're done.
If you want to turn it off (even temporarily), just tools|addins and uncheck it.
--
Dave Peterson
> (I made a minor change to J.E.'s code. He can yell at me later <vbg>.)
Now why would I yell - I actually LIKE the change (though I rarely have
more than one window open per file...)