Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

fit zoom to window

Hi there,

I've search over the forum and saw that some people here meet this issue.

Well I'm using QV ver.9 ,all I want to do is to fit zoom to window when opening a sheet,

most of the time-this simple macro doesn't working! sub fitzoom

ActiveDocument.ActiveSheet.FitZoomToWindow

end sub









any suggestion ?



1 Solution

Accepted Solutions
Not applicable
Author

Are you saying it never works when switching between sheets or just not on initial load?

Try this line in the sub before the 'FitZoomToWindow':

ActiveDocument.GetApplication.WaitForIdle

Regards,

Gordon

View solution in original post

5 Replies
Not applicable
Author

If you have this macro attached to the 'OnActivateSheet' event for a sheet, it is not fired for that which is initially displayed. The way I work around this is to invoke the document with a dummy macro being passed eg

qvp://xxxxxxx/document.qvw?MACRO=Clear

After this macro is run, then the 'OnActivateSheet' event for the initial sheet is fired and your zoom should work.

Regards,

Gordon

Not applicable
Author

hi,

well yes,I have attached this macro to each sheet and this macro supposed to work

when entering the sheet.

I didn't understand your solution (VB isn't really my strong side) ,can you pls attach an example?

Than,

DAVID

Not applicable
Author

Are you saying it never works when switching between sheets or just not on initial load?

Try this line in the sub before the 'FitZoomToWindow':

ActiveDocument.GetApplication.WaitForIdle

Regards,

Gordon

Not applicable
Author

Great,Gordon-its working.

But I'm not so sure why and how.... Embarrassed

johnw
Champion III
Champion III

The wait for idle at the top tells QlikView to wait until it finishes doing everything else, THEN fit the zoom to the window. If that fixed your problem, chances are that QlikView was busy doing something that prevented it from doing the fit zoom to window at the time.