Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Or
Valued Contributor II

Applying FitZoomToWindow on all sheets via macro

Dear all,

I'm trying to adapt existing macros to apply Fit Zoom To Window for all sheets.

I am easily able to apply Fit Zoom to the active sheet:

ActiveDocument.ActiveSheet.FitZoomToWindow

I am also able to then apply this zoom to all sheets. However, my specific need is to apply Fit Zoom To Window to each sheet individually, as the sizing of objects in each sheet is different and a single zoom setting is not appropriate for all sheets.

I was able to come up with a macro that does this, but in order to do so, it physically cycles between all of the sheets (and back to the original):

Sub Zoom

For i = 0 To ActiveDocument.NoOfSheets - 1

      ActiveDocument.ActivateSheet i

      ActiveDocument.GetApplication.WaitForIdle

        ActiveDocument.ActiveSheet.FitZoomToWindow

        Next    

        ActiveDocument.ActivateSheet 0

End Sub

Unfortunately, this cycling is visible to the user and looks unprofessional and "blinky".

If anyone is familiar with syntax for applying Fit Zoom To Window to a sheet without activating it first, I'd be much obliged if you could assist me with adapting this macro.

Thanks in advance,

Or

Tags (1)
5 Replies
Employee
Employee

Re: Applying FitZoomToWindow on all sheets via macro

Maybe you can attach a macro to OnActivate trigger of each sheet

Sub ZoomMe

        ActiveDocument.ActiveSheet.FitZoomToWindow

End Sub

Or
Valued Contributor II

Re: Applying FitZoomToWindow on all sheets via macro

This was actually my starting point. Unfortunately, this is not a desirable solution - it interferes with the user's ability to set their own zoom, if they so desire (e.g. they would like an easier-to-read view and are willing to scroll) and users have found it confusing. This is why I'm looking for an OnOpen-based, set-it-and-forget-it solution.

Or
Valued Contributor II

Re: Applying FitZoomToWindow on all sheets via macro

Bump - hoping someone in the know will catch sight of this.

eliahuattia
New Contributor

Re: Applying FitZoomToWindow on all sheets via macro

rremove the line: ActiveDocument.GetApplication.WaitForIdle

MVP & Luminary
MVP & Luminary

Re: Applying FitZoomToWindow on all sheets via macro

Maybe this one:

rem ** fit active sheet to window and apply same zoom to all sheets **

ActiveDocument.ActiveSheet.FitZoomToWindow

ActiveDocument.ActiveSheet.ApplyZoomToAllSheets

- Marcus