View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
dok112[_117_] dok112[_117_] is offline
external usenet poster
 
Posts: 1
Default Can a macro be written that when you open a workbook the zoom will be set for each sheet?


You will get that error if you have put the code in the wrong spot, or
if you are attempting to make the zoom too large. You can go from 10
to 400 percent. If you put that code in a regular module, you will get
that error. It has to go into the ThisWorkbook object so it knows to do
it when it opens.

Marc Wrote:
Spoke to soon. I copied it and change the 100 to 75 and tried to run it
and
I get a run time error '1004' "Select method of Worksheet class
failed".

Marc

"dok112" wrote
in
message ...

Yes.

In Microsoft Visual Basic Editor, under ObjectsThisWorkbook, input

the
following code:

Private Sub Workbook_Open()
For Each ws In Worksheets
ws.select
ActiveWindow.Zoom = 100
Next
End Sub

Change the zoom to whatever zoom you want it to be. do not include

the
% symbol


--
dok112

------------------------------------------------------------------------
dok112's Profile:

http://www.excelforum.com/member.php...o&userid=10581
View this thread:

http://www.excelforum.com/showthread...hreadid=530168



--
dok112
------------------------------------------------------------------------
dok112's Profile: http://www.excelforum.com/member.php...o&userid=10581
View this thread: http://www.excelforum.com/showthread...hreadid=530168