Microsoft Excel / Word - shortcut to Zoom Text

In Safari or Firefox, we use Cmd + or Cmd - to zoom text.

I am trying to see if I can use KM to create such a macro to zoom in Excel and Word. The problem is, in both Excel and Word, the Menu item has Zoom, when you click them, a dialog box appear:

No one use this dialog box because it requires many clicks. Instead, every one use the mouse to adjust it in the status bar:

I don't think I should use a KM macro on mouse pointer or as the Word or Excel window is not in a fix position. Any tips on how I should approach this? I want to be able to simulate the same behavior of tapping Cmd + and the zoom will increase by 10%.

It sounds like serious KM-fu is needed !

You can probably automate this using Excel and Word VBA macros.
Record a macro using the "Custom" option. Then edit the macro to add a User Prompt to ask for the zoom value. The prompt could accept a + or -, and then change the zoom accordingly.

Here's a quick Excel VBA I just made:

Sub zoom()
' Zoom Macro
    Dim zoomTo As Variant
    zoomTo = InputBox("Enter Zoom")
    ActiveWindow.zoom = zoomTo
End Sub

Fortunately for you, I've had this same problem and came up with a series of AppleScript-based macros to solve it some time ago:

Office 2016 Zoom Macros.kmmacros (25.9 KB)

There are others included as well for zooming straight to 100%, 120%, 150%, and 200%. I have different shortcuts assigned to these, but you can of course change the 10% ones to + and - as you like.


Thanks @JMichaelTX and @gglick - much appreciated. Gabe's macro works! This is such a great time saver and will help me very much in my day to day work. The problem with Retina screen is that at 100%, it is just too small for my old eyes and I need to constantly zoom! Much love! <3


I supposed these cool icons are also keyed in using KM macro? :slight_smile:

You got it. This forum (maybe all Discourse forums?) lets you create key glyphs like that by surrounding text with <kbd></kbd>, and I do indeed have a macro that automates the process:

Format Keys.kmmacros (3.6 KB)

1 Like

Thanks for the mention of VBA. I’ve been wanting to automate lots of Excel and PowerPoint and run into just this sort of UI issue.

The question becomes how to set up the VBA in an arbitrary presentation/spreadsheet. In particular whether it’s possible to automate injecting VBA into a new one - presentation/spreadsheet.

Easy. Just store the VBA macros in the Word Normal template and Excel Personal workbook. Then they can be used with any document.

1 Like

Thanks. That suggests if handed a template I have to use that I one time modify it by copying in the VBA code. I’ll have to practice that.

You mentioned Word and Excel - the latter being the thing I curse at a lot[^1]. You didn’t mention PowerPoint so I wonder if something similar exists there.

[^1]: A true bonding moment when two or more people gather round Excel and swear at it. :slight_smile: I’ve done this with my friends in customers several times now. :slight_smile:

I'm not sure exactly what you mean by that, but it is very easy to specify the file/template in which to store a VBA Macro:

  1. If you use the "Record Macro" feature, it will ask you where you want to store the macro. Just pick "Normal" for Word or "Personal Workbook" for Excel.
  2. If you open the VBA Editor, you should see "Projects". If not, goto the VBA Editor menu View > Project Explorer



I hope this clears things up.

1 Like

Thanks for the above.

Occasionally I get handed a corporate template that I’m expected to use. I doubt anyone would notice if I copied macros into it. I’m just thinking about how I might manage that. The answer is to keep the macros in a flat file and copy them in when the template changes. But that is a small sync problem - if I actively develop macros.

One you have the VBA macros in a Word/Excel file, you can easily export that Module as a ".bas" file. Then you can easily import that same file into other files.

1 Like

Thanks for this. Now that I'm teleworking, I'm dealing with a lot more Excel spreadsheets created by Windows users. The shrinkage was pissing me off. Your macro gave me the info I needed. I made a simple CMD+1 macro to zoom to 125%.

tell application "Microsoft Excel" to set zoom of front window to (zoom of front window) + 25

These work great. I turned them into a Palette Menu from 100% to 275% in 25pt increments. Perfect! Thank you!