Set Zoom at startup?

  • Thread starter Thread starter Rick
  • Start date Start date
R

Rick

Is there a way to reset the Zoom or View of all of a Workbooks Worksheets in the ThisWorkbook
object. I have looked through the help and all I find is:

Application.ActiveWindow.Zoom = 75

which sets the active windows...

Thanks,

Rick
 
Hi Rick

Try the code below

Private Sub Workbook_Open()
Dim wSheet As Worksheet
Dim wsStart As Worksheet
Set wsStart = ActiveSheet
Application.ScreenUpdating = False
For Each wSheet In Worksheets
wSheet.Select
ActiveWindow.Zoom = 75
Next wSheet
wsStart.Select
Application.ScreenUpdating = True
End Sub


***** Posted via: http://www.ozgrid.com
Excel Templates, Training & Add-ins.
Free Excel Forum http://www.ozgrid.com/forum *****
 
Dave said:
Hi Rick

Try the code below

Private Sub Workbook_Open()
Dim wSheet As Worksheet
Dim wsStart As Worksheet
Set wsStart = ActiveSheet
Application.ScreenUpdating = False
For Each wSheet In Worksheets
wSheet.Select
ActiveWindow.Zoom = 75
Next wSheet
wsStart.Select
Application.ScreenUpdating = True
End Sub


***** Posted via: http://www.ozgrid.com
Excel Templates, Training & Add-ins.
Free Excel Forum http://www.ozgrid.com/forum *****

That's as easy as it gets? I already have some startup code within "Application.ScreenUpdating="
statements so this will be easy enough to add...I was hoping for a Workbook property, but this will
do thanks,

Rick
 
You can do it for all sheets/all workbooks using an Application event.

In your Personal.xls file (or other file in your XLStart directory, put
this code in the ThisWorkbook code module:

Dim clsMyWindow As New WindowClass

Private Sub Workbook_Open
Set clsMyWindow.App = Application
End Sub


And in a new *class* module that you name WindowClass:

Public WithEvents App As Application

Private Sub App_SheetActivate(ByVal Sh As Object)
ActiveWindow.Zoom = 75
End Sub

Save Personal.xls, close XL, and restart - now all worksheets will
display at 75%.
 
Yep - I perhaps should have made an exception for instantiating class
objects, but I guess at the time it didn't seem apropos to the level of
the question.
 
Back
Top