zoom to 90%

D

Deepak

Hi

I want every excel file to open at a Zoom percentage of 90%.

How can it be possible.

Please help

Deepak
Chd, India.
 
D

Don Guillett

Here is one I use to set the zoom to the user's screen resolution. It should
be put into the ThisWorkbook module. It also requires a defined name (my
zoom) for the range to be zoomed on EACH page. Modify to suit your need of
90% for all pages. Come back if you need more help.


Private Sub Workbook_Open()
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False

Dim tstRange As Range
Dim curWks As Worksheet
Dim wks As Worksheet

For Each wks In ActiveWorkbook.Worksheets
With wks
If wks.Name <> "Parts" And wks.Name <> "Kits" Then
Set tstRange = Nothing
On Error Resume Next
Set tstRange = .Range("myzoom")
On Error GoTo 0
If tstRange Is Nothing Then
'do nothing
Else
.Select
tstRange.Select
ActiveWindow.Zoom = True
.Range("a1").Select
End If
End If
End With

Next wks
Sheets("cover").Select
Application.ScreenUpdating = True

Application.Calculation = xlCalculationAutomatic

End Sub
 
J

JE McGimpsey

To do this for every file, you'll need to use an Application-level event.

Put this code in an add-in that you place in your XLStart directory:

First, create a class module, named, say, MyWindowClass

In the class module, enter:

Public WithEvents oApp As Application

Private Sub oApp_SheetActivate(ByVal Sh As Object)
ActiveWindow.Zoom = 90
End Sub

In a regular code module, enter:

Public clsMyWindow As MyWindowClass

substituting your class name for MyWindowClass, if necessary.


Finally, in the ThisWorkbook code module, enter

Private Sub Workbook_Open()
Set clsMyWindow = New MyWindowClass
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top