• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Need Code to Increase Viewing size(%)

Montrey

Member
Hey guys!


My executives don't have the best eye sight. I want to make a button that they can easily press which will increase the viewing size. I need the button to increase the viewing size by 5% each time the button is pressed starting at 100% up to 120%. Then if the user clicks the button again after 120% the viewing size goes back to 100%


Thanks so much!
 
Hi, Montrey!


As far as I can see you have these three options:

a) changing your executives for best eye-sighted ones

b) providing them with the new Google glasses for augmented reality (https://plus.google.com/111626127367496192147/posts)

c) inserting this code assigned to a command button within your sheets

-----

[pre]
Code:
Option Explicit

Private Sub cmdZoom_Click()
' constants
Const kiMinimum = 100
Const kiMaximum = 120
Const kiIncrement = 5
' declarations
Dim I As Integer
' start
I = CInt(Left$(cmdZoom.Caption, 3))
' process
I = I + kiIncrement
If I > kiMaximum Then I = kiMinimum
ActiveWindow.Zoom = I
' end
cmdZoom.Caption = CStr(I & "%")
End Sub
[/pre]
-----


It's up to you... (I vote for "a"...)


Regards!
 
Hey SirJB7!


I totally agree! ;). I am getting an error variable not defined. It highlights the"cmdzoom" in the I = CInt(Left$(cmdZoom.Caption, 3)) line.
 
Hi, Montrey!

Assuming you copied the whole code (so there's a Dim statement for I variable), did you name the command button added as cmdZoom?

Regards!
 
Hi, Montrey!


What type of command button did you add? A form control or an ActiveX control? This works automatically for the second type only; for the first type you should manually assign the macro to the added control.


Give a look at this file: http://dl.dropbox.com/u/60558749/Need%20Code%20to%20Increase%20Viewing%20size%28%25%29%20%28for%20Montrey%20at%20chandoo.org%29.xlsm


Regards!
 
Back
Top