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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
hopkinsc
Partner - Specialist III
Partner - Specialist III

zoom

Hi,

Is it possible to use a custom zoom instead of the standard :

25% 50% 75% 100% 125% 150% 175% 200% 400%

I know i can use the 'Fit Zoom to Window' option, but i would like if possible the user to input a zoom level themselves using an input box or selecting from a list box.

Thanks

11 Replies
hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

any update on this?

Not applicable

Hi,

You can use a macro and set in document properties, Triggers / Filed Event Triggers / On Selection

Set a external / Run Macro

Create macro and set then

SUB ZOOM

set mysheet=ActiveDocument.ActiveSheet
set sp=mysheet.GetProperties
sp.ZoomFactor = ActiveDocument.Fields("YOUR_FIELD").GetSelectedValues.Item(0).Text
mysheet.SetProperties sp

END SUB

hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

Thanks Eduardo.

What do i put instead of YOUR FIELDS though? I want to change the zoom on the enire sheet not a specific field. or am i missunderstanding it?

Not applicable

Hi,

YOUR_FIELD reference a number of zoom that you want.

TABLE_ZOOM:

0.10

0.20

0.30

...

This zoom will be reflected in you sheet.

tanelry
Partner - Creator II
Partner - Creator II

I have played with this once.

Here is a macro built around a variable called "zoom" (default value: 100%).

The variable has "on input" trigger which runs the macro.

You can change the variable via slider or buttons.

Have fun!


sub zoom
zoomvalue = ActiveDocument.Evaluate("num(zoom)")
set mysheet=ActiveDocument.ActiveSheet
set sp=mysheet.GetProperties
sp.ZoomFactor = zoomvalue
mysheet.SetProperties sp

ActiveDocument.GetApplication.WaitForIdle

ActiveDocument.ActiveSheet.ApplyZoomToAllSheets
end sub


hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

Thanks Tanel.. I am getting an error when tring to run the macro

the edit module box appears with the error:

Type mismatch: 'sp.ZoomFactor'

Have you got an example of this working you could upload please??



tanelry
Partner - Creator II
Partner - Creator II

should be working. Try variable value 1 then 1.1 or 0.9.

If still error, it could be local settings issue (decimal sep). Then use integers (100, 110) in variable and make division in macro:

change this line to: sp.ZoomFactor = zoomvalue * 0.01

hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

Hmm, still not working. It doesnt like 'zoomvalue'....

hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

Can you confirm that this is right please?

I'm lost now 😞

sub zoom
zoomvalue = ActiveDocument.Evaluate("num(zoom)")
set mysheet=ActiveDocument.ActiveSheet
set sp=mysheet.GetProperties
sp.ZoomFactor = zoomvalue * 0.01
mysheet.SetProperties sp
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.ActiveSheet.ApplyZoomToAllSheets
end sub