VBA syntax for one-line of code

D

Dennis

Using XL 2003 & 97

Attempting to get the following code loop to work.

The code fails where the ???????.?????? is.

Sub Test()
Dim EachSheet As Worksheet
For Each EachSheet In ActiveWorkbook.Worksheets
With EachSheet.?????????.??????????
ActiveWindow.Zoom = 75
ActiveWindow.View = xlPageBreakPreview
End With
Next EachSheet
End Su

Any thoughts?

TIA Dennis
 
F

Frank Kabel

Hi
do you want:
Sub Test()
Dim EachSheet As Worksheet
For Each EachSheet In ActiveWorkbook.Worksheets
EachSheet.activate
ActiveWindow.Zoom = 75
ActiveWindow.View = xlPageBreakPreview
Next EachSheet
End Su
 
D

Dennis

Thanks Frank,

The code flows ok now. That said, it does not seem to be setting the .zoom
to 75

Is the code line ActiveWindow.Zoom = 75 correct.

What I want is all worksheets to be set for zoom = 75 and the view be set for
PageBreakPreview.

TIA Dennis
 
D

Dave Peterson

What does the zoom get set to.

(Frank's code changed it to 75% for me--but if the worksheet were empty, the
zoom was changed to 60%.)

But when I reversed the two lines that did the work, all was ok:

Option Explicit
Sub Test2()
Dim EachSheet As Worksheet
For Each EachSheet In ActiveWorkbook.Worksheets
EachSheet.Activate
ActiveWindow.View = xlPageBreakPreview
ActiveWindow.Zoom = 75
Next EachSheet
End Sub
 
Top