Doing things with the Windows object is one of the few occasions you do need
to use select or activate. Though in this case you could do all in one go,
select all sheets, change the view to xlNormalView (if the activesheet was
already xlNormalView you'd need to change all to xlPageBreakPreview first)
But why not loop through your sheets first with screenupdating disabled and
set each view as required (only if necessary). Perhaps store any changed
settings in an array to be reset when done.
Enable screenupdating and do your stuff. IOW two loops, or perhaps three if
you want to reset.
Regards,
Peter T
"michael.beckinsale" <(E-Mail Removed)> wrote in message
news:5243fd77-09d5-4513-a2e2-(E-Mail Removed)...
> Hi All,
>
> Below is a code snippet from a routine that loops through each sheet
> in a workbook. The routine copies / pastes ranges into powerpoint so l
> need to ensure the sheet is in normal view to avoid pages numbers etc
> being passed to PP
>
> Sht1.Activate
> If ActiveWindow.View = xlPageBreakPreview Then
> ShtView = "Yes"
> ActiveWindow.View = xlNormalView
> End If
>
> How can l achieve this without using Sht1.Activate?
>
> I want to avoid the 'flashing' caused by the Sht1.Activate. If l use
> Application.Screenupdating = False the data is not passed to PP
>
> Regards
>
> Michael
|