Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Change window zoom % based on slider object variable

I have a standard slider object that assigns a value 1 - 200 to a variable named "Zoom".

I am trying to assign a macro to a button that will adjust the zoom % of the screen based on the value of "Zoom". Here is the macro so far:

sub SlideZoom

set vZoom = ActiveDocument.Variables("Zoom")

set mySheet = ActiveDocument.ActiveSheet

set sp = mySheet.GetProperties

  sp.ZoomFactor = vZoom

  mySheet.setProperties sp

end sub

Basically I would like to eliminate going through View->Zoom->Select % to change the zoom % of the window. Whenever I click the button the module window opens, indicating that I have an error. Any suggestions for how I can get this to run?

Thanks!

Michael

2 Replies
Not applicable
Author

zoom

Here is a solution, made by Tanel Rüütli. I used a button to call for macro.

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


edit: I set the value of the variable (Zoom) with slider and after that I call the macro with a button. Works fine

ashfaq_haseeb
Champion III
Champion III

Hi,

I don't think you can apply custom zoom.

have a look at this attached extension.

Which will fix zoom as per the size of window.

Regards

ASHFAQ