Default view of Excel to 75%

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
I want to set the default view of excel to 75% . When ever I open Excel or a
new file in Excel the view should be 75% by default.
 
Hi Gaurav

Open a new workbook
On all sheets set zoom to 75%
Save the file as "Book" (no quotes) in your startup folder as a template.

Every workbook you create will have this settings now
 
Open a new workbook, set the zoom to 75% and save it as a template (.xlt).
Use the template for all new workbooks - you access it by clicking on
file-new. HTH
 
If you want that zoom for just new workbooks, you can ignore this. But if you
want that zoom whenever you open any workbook....

Create a new workbook.
Add this code to the ThisWorkbook module (hi, Bob!):

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, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

You can read a lot more about application events at Chip Pearson's site:
http://www.cpearson.com/excel/AppEvent.htm
 
Dave,
I got a compile error at the line

Public WithEvents xlApp As Application

in Excel 2003 when I opened the application. Thanks.
 
Did you put the code in the ThisWorkbook module?
Dave,
I got a compile error at the line

Public WithEvents xlApp As Application

in Excel 2003 when I opened the application. Thanks.
 
Yes, I did exactly that in the Visual Basic window, and then saving the file
as Book1.xla in the XLStart folder.
 
Try saving as a Template named BOOK.xlt in your XLSTART folder.


Gord Dibben MS Excel MVP
 
I wouldn't use a .xlt template file for code like this. It doesn't need to be
in each workbook that excel opens--just one workbook that opens when excel
opens.
 
I would have used a nicer (less generic) name, but book1.xla is ok if you want.

My next guess is that there are other characters on that line.

You may have found the code using some web interface (google?) and copying from
that web page may have introduced some extra characters.

Select that line and delete it.

Then retype it.


Yes, I did exactly that in the Visual Basic window, and then saving the file
as Book1.xla in the XLStart folder.
 
Back
Top