Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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 ?
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
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
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
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
Great,Gordon-its working.
But I'm not so sure why and how.... ![]()
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.