This is cool! This is fresh! Make your Word and Excel to respond to human zoom commands like normal applications.
In most modern applications you can zoom in and zoom out current window using fast Ctrl + Plus and Ctrl + Minus keyboard shortcuts.
Not so in Word and Excel. Even in the latest ones – from Office 2013 – you do not have this functionality. Finally, finally here in this article you learn how to do it with macros. Word partial idea was published before on other site (see below), but Excel technique uses new and exciting macro.
WORD
To make keyboard combinations Ctrl+[+] and Ctrl+[-] to work in Word you need to create these three macros in NORMAL.DOT or NORMAL.DOTM depending on your Office version:
' Assign Ctrl + [+] Sub ZoomIn() If ActiveWindow.View.Zoom < 450 Then ActiveWindow.View.Zoom = ActiveWindow.View.Zoom + 10 End If End Sub ' Assign Ctrl + [-] Sub ZoomOut() If ActiveWindow.View.Zoom > 20 Then ActiveWindow.View.Zoom = ActiveWindow.View.Zoom - 10 End If End Sub ' Assign Ctrl + 0 Sub ZoomReset() ActiveWindow.View.Zoom = 100 End Sub
Now assign desired keyboard key combinations to these macros, and you are ready to test. It takes about 7 easy steps to assign a key combination to a macro. On a plus side, you’ll never do it by accident.
Here are the steps to assign keyboard combination to a macro:
01 right-mouse click on the ribbon -> Customize the Ribbon
02 find Keyboard shortcuts and click Customize
03 scroll to the bottom of Categories and select Macros on the left
04 select your macro on the right
05 slick inside Press new shortcut key box
06 press desired keyboard combination
07 click on button Assign
Enjoy!
EXCEL
For Excel this is a bit more complicated, because you can’t assign special characters to Excel macros. We would need to work around this limitation:
First create the same familiar three macros in Excel PERSONAL.XLS file:
Sub ZoomIn() Dim ZP As Integer ZP = Int(ActiveWindow.Zoom * 1.1) If ZP > 400 Then ZP = 400 ActiveWindow.Zoom = ZP End Sub Sub ZoomOut() Dim ZP As Integer ZP = Int(ActiveWindow.Zoom * 0.9) If ZP < 10 Then ZP = 10 ActiveWindow.Zoom = ZP End Sub Sub ZoomReset() Dim ZP As Integer ZP = 100 ActiveWindow.Zoom = ZP End Sub
Next create a special macros that run every time you open Excel:
Private Sub Auto_Open() ' Replace standard key shortcuts with custom zooming Application.OnKey "^{=}", "ZoomIn" Application.OnKey "^{-}", "ZoomOut" Application.OnKey "^0", "ZoomReset" End Sub
This macro assigns macros to desired key combinations. Save and exit Excel completely. It is time to test.
Sources
An initial idea for this post was picked up in this article:
Thank you! Now I will use this technique for other missing key combinations.
Be the first to comment