Change Magnification default global setting

S

Steve

I work with large spreadsheets. Every time I open a sheet, it opens at 100%
and I then have to reduce it to the 75% setting. 75% is my normal viewing
setting every day. Is there a way to set a gobal setting default of some
kind so when I open a spreadsheet it will always open at the 75%
magnification level.
Thanks,
Steve
 
D

Dave Peterson

Saved from a previous post:

For brand new workbooks, you could create a book.xlt workbook template (stored
in your XLStart folder) that has each window the way you want.

If you want existing workbooks, then ...

Create a new workbook.
Add this code to the ThisWorkbook module:

Option Explicit
Public WithEvents xlApp As Application
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Set xlApp = Nothing
End Sub
Private Sub Workbook_Open()
Set xlApp = Excel.Application
End Sub
Private Sub xlApp_NewWorkbook(ByVal Wb As Workbook)
Call DoTheWork(Wb)
End Sub
Private Sub xlApp_SheetActivate(ByVal Sh As Object)
Call DoTheWork(Sh.Parent)
End Sub
Private Sub xlApp_WorkbookOpen(ByVal Wb As Workbook)
Call DoTheWork(Wb)
End Sub
Private Sub DoTheWork(Wb As Workbook)
Dim myWindow As Window
For Each myWindow In Wb.Windows
myWindow.Zoom = 75
Next myWindow
End Sub

Save this file as an addin in your XLStart folder.

Each time you create a new workbook, open an existing workbook, change to a new
sheet, it'll set the zoom to 75%.

If you're new to macros:

Debra Dalgleish has some notes how to implement macros here:
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)
 
S

Steve

WOW, works great, many thanks...

Steve

Dave Peterson said:
Saved from a previous post:

For brand new workbooks, you could create a book.xlt workbook template (stored
in your XLStart folder) that has each window the way you want.

If you want existing workbooks, then ...

Create a new workbook.
Add this code to the ThisWorkbook module:

Option Explicit
Public WithEvents xlApp As Application
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Set xlApp = Nothing
End Sub
Private Sub Workbook_Open()
Set xlApp = Excel.Application
End Sub
Private Sub xlApp_NewWorkbook(ByVal Wb As Workbook)
Call DoTheWork(Wb)
End Sub
Private Sub xlApp_SheetActivate(ByVal Sh As Object)
Call DoTheWork(Sh.Parent)
End Sub
Private Sub xlApp_WorkbookOpen(ByVal Wb As Workbook)
Call DoTheWork(Wb)
End Sub
Private Sub DoTheWork(Wb As Workbook)
Dim myWindow As Window
For Each myWindow In Wb.Windows
myWindow.Zoom = 75
Next myWindow
End Sub

Save this file as an addin in your XLStart folder.

Each time you create a new workbook, open an existing workbook, change to a new
sheet, it'll set the zoom to 75%.

If you're new to macros:

Debra Dalgleish has some notes how to implement macros here:
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)
 

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