Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

helen_pip
Contributor II

FitZoomToWindow Not working

Hello

I have researched on the internet and have found the following code:

  SUB FitZoomToWindow

ActiveDocument.ActiveSheet.FitZoomToWindow
ActiveDocument.ActiveSheet.ApplyZoomToAllSheets

END SUB

However this does not seem to be working in my button which I ahve assigned the macro too

I understand the above script to be VBScript, I am running this off our server which has Excel 2007 installed.  I know that Microsoft have stopped external uses for running vbscript in Excel 2007, could this be why the macro is not working for me?

Has anyone else experienced the syntex not running, and how they overcame this problem?

Thanks

Helen

2 Replies
Not applicable

Re: FitZoomToWindow Not working

Hi Helen

try this macro:

SUB Zoom

set CurrentSheet=ActiveDocument.ActiveSheet

set proper=CurrentSheet.GetProperties

proper.ZoomFactor = 1 ' try 1 to 4

CurrentSheet.SetProperties proper

END SUB

Not applicable

Re: FitZoomToWindow Not working

Hey,

I had the same problem and found the answer there:

http://www.qlikblog.at/444/qliktip-16-zoom-mit-makro-automatisieren/

The tricky point is to add the following line between the commands:

ActiveDocument.ActiveSheet.FitZoomToWindow 

ActiveDocument.GetApplication.WaitForIdle 

ActiveDocument.ActiveSheet.ApplyZoomToAllSheets

ActiveDocument.GetApplication.WaitForIdle 

I hope that helps!