Home / Resources / Windows Macros FAQ

Windows Macros FAQ

Version 4.1

Copyright © Alan Cantor 2005 - 2014. All rights reserved.


Welcome to the Windows Macros FAQ. This resource is for people who want to operate Windows® more efficiently by taking advantage of macro software and macro techniques.

Running Windows® without macros is like cycling through the mountains on a fixed-gear bicycle. It can be done, but it is unnecessarily difficult. Think of macros as gears for your computer. Macros reduce physical and mental effort while multiplying speed and increasing efficiency.

This FAQ has four main sections. Fundamentals answers basic questions about macros. Smart Macros introduces the topic of macros with built-in intelligence. A smart macro acts on the basis of information received both from the user and from the user interface, and provides elegant, reliable, and seamless fixes to otherwise intractable accessibility and usability problems. The global hotkey section describes a standard Windows® technique for opening files, web pages, and folders, and for launching applications. The fourth section discusses two application-specific macro techniques: code replacement shortcuts and built-in macro languages.

This is a work-in-progress. Bookmark this page and check back often. Your feedback and questions are welcome.


What is a macro?

A macro is a software shortcut for performing a series of steps or commands as a single task. Tasks may be simple, such as inserting a word; or complex, such as copying data from one program and pasting it in another. More sophisticated macros actively and passively collect information from the user and from the user interface, and make decisions on the basis of this new data.

Examples of tasks that can be performed using macros:

Why write macros?

Macros save time, energy, and frustration. Macros automate repetitive, awkward, physically-demanding and mentally-taxing tasks. In addition, accessibility and usability problems can sometimes be fixed with macros.

What macro applications are available?

Macro applications come in two "flavours:" those that act on programs from the inside; and those that act on programs from the outside.

“Insider” vs. “Outsider” macro applications

Programming languages built into existing programs, such as Visual Basic for Applications (VBA) for Microsoft Office products, and PerfectScript for Corel products, do their work from the inside. Once created, the macros reside within and are integrated into the programs for which they are written. For example, VBA commands for Microsoft Word are stored in a binary file called Normal.dot. The commands and macros contained in this file load automatically each time Word is launched.

"Outsider" macro applications are third-party scripting utilities. The macros that these tools produce reside in the macro application itself (or in executables that the macro application generates). The macros are "outsiders" in the sense that the macro software is distinct from the programs it affects, and its macros act upon other programs — usually by sending keystrokes and/or controlling the mouse pointer.

Examples of full-featured Windows®-based macro scripting tools:

Other macro packages:

The macros produced by built-in programming languages tend to be more portable than those produced by third-party scripting tools. Whereas VBA macros should, in theory, work equally well on all computers, "outsider" macros may need tweaking — and sometimes rewriting — to work on another PC.

As a general rule, "insider" macros are more reliable than "outsider" macros, and "outsider" macros are more versatile than "insider" macros. A skilled developer knows how to make "insider" macros versatile, and "outsider" macros reliable.

Are macro development tools easy to use?

Macro Express is powerful and easy to use. Keyboard Express, which is made by the same company, lacks many features included in Macro Express. ActiveWords is fairly easy to use, but lacks features found in Macro Express. AutoHotkey is very powerful but lacks a user interface to simplify macro creation; the learning curve is steep. Macro Scheduler is less versatile than either AutoHotkey and Macro Express. It is easier to learn than AutoHotkey, but harder to use than Macro Express.

VBA is a full-blown programming environment for controlling and interacting with an application's "objects." Learning to manipulate objects may be challenging for those without experience with other object-oriented programming languages. VBA is probably harder to learn than PerfectScript.

Are macro applications screen-reader accessible?

Full-featured screen readers have built-in macro scripting languages. The macro-writing tools in JAWS and Window-Eyes have been optimized for screen reader access, and work elegantly with speech.

Some software access problems are best resolved by scripting speech-friendly macros with third-party scripting tools. But because screen readers and macro applications both intercept input from the keyboard, conflicts can arise. The following compatibility information is based on reports from screen reader users:

Macro Express

Macro Express 3.x menus are difficult to access with JAWS, but it is possible. Set "Menu style" to "Flat" to improve screen reader access. (Options menu, Preferences...) Menus are easily accessed with Window-Eyes.

Overall, the Macro Express user interface is not particularly speech-friendly. Dialog boxes are fairly accessible, but some controls have non-standard behaviour, such as the list of hotkeys when choosing an activation method. It is possible to Tab to the list of hotkeys, but navigating backwards from the list causes Shift+Tab to be selected as the hotkey. Some wizards work better than others with speech, but most cannot be accessed without using the roving cursor.

Macro Express macros can be activated when JAWS is running, but not when Window-Eyes is running. I have seen people using Window-Eyes to script macros, and JAWS to test and run them.


Not yet tested with JAWS. ActiveWords does not appear to conflict with Window-Eyes.


Very easy to access because macros can be written in any text editor. The downside is that there is no user interface to simplify macro creation. No screen reader compatibility problems for activation have been reported.

Macro Scheduler

No screen reader compatibility problems have been reported for JAWS or Window-Eyes.

Visual Basic for Applications

VBA is fairly screen reader accessible, although some features are difficult or impossible to access with speech. Nevertheless, I have met developers with visual impairments who code in VBA via screen reader.

How are macros created?

There are four main macro creation techniques:

Capture (Macro recorder)

Record command sequences by typing, pressing hotkeys, and manipulating the mouse. The technique works best for simple tasks; it is less reliable for complex ones. Some macro recorders capture mouse movements, and others do not. Captured mouse movements are notoriously unreliable when replayed. VBA's macro recorder ignores many (but not all) mouse movements, but it does reliably record the same actions when performed by keyboard.


A wizard guides the user through a series of questions, and automatically generates a script. Macros created in this way work best for simple tasks.

Direct editing

Type or insert commands directly into a macro editor. This technique is very powerful, but may require programming experience.

Semi-automatic scripting

Select, insert, and edit commands via a user interface to build a script. This technique is adequate for crafting all but the most complex macros.

How are macros activated?

There are at least 13 different macro triggers. The six main ones are:


To activate a hotkey macro, the user presses a key or a key combination. There are two kinds of hotkey macros:

  1. A single-key hotkey executes after pressing a single key or key combination. For example, launch an e-mail program by pressing Ctrl+E.
  2. A dead-key hotkey executes after pressing a sequence of two keys. Nothing appears on the screen when the first key is pressed; the macro activates only after the second key is pressed. For example, in some applications, pressing Ctrl+/ followed by O inserts Ø.


Code macros are triggered by typing text. The macro runs when a specific sequence of characters has been entered. There are two kinds of code macros:

  1. Suffix macros are triggered by typing a code followed by Spacebar, Enter, and punctuation characters ("suffix keys"). For example, typing TEL followed by a suffix key inserts your telephone number; WP followed by a space launches a word processor; and SIG followed by a space, punctuation mark, or Enter inserts a signature file.
  2. Prefix macros are activated by typing a user-selected prefix followed by a code. For example, if J is the prefix, entering JTEL types a telephone number; JWP launches a word processor; and JSIG inserts a signature file.

When code macros execute, the code and the prefix/suffix are usually deleted. The macro may have untoward effects if pressing Backspace does something other than delete characters. In Internet Explorer, for example, pressing Backspace goes "Back" to the previous web page (unless an edit box has keyboard input focus.)


Timed macros activate at specific times, at set intervals, or after certain delays. They are used to run programs at set intervals, display timed reminders, and regulate the timing in multi-step macros. For example, when writing a macro to copy the URL of a web page and paste it in NotePad, it may be necessary to wait for NotePad to appear before issuing the "Paste" command. The macro might consist of five steps:

  1. Go to the Address line and select it. (In Mozilla Firefox or Internet Explorer, press Alt+D.)
  2. Copy to the clipboard.
  3. Switch to Notepad.
  4. Wait 2 seconds.
  5. Paste.

Macros execute very quickly. Without a "Wait" command, this macro may issue the paste command before Notepad gains focus.


Event macros execute when specified programs, windows, or controls gain or lose focus. Event macros are needed to regulate complex command sequences. The previous example will be more reliable if the "Paste" command is triggered by the appearance of NotePad (an event) rather than the passage of a fixed number of seconds:

  1. Go to the Address line and select it.
  2. Copy to the clipboard.
  3. Switch to Notepad.
  4. Wait until Notepad has focus.
  5. Paste.


Mouse macros are activated by clicking on specific areas of the screen; on user-defined menus or icons; or simply by clicking anywhere on the screen. For the latter type, it is usually necessary to hold down one or more modifier keys. Macros can also be actviated by clicking the middle mouse button.


Products like NaturallySpeaking and Microsoft Speech Recognition allow users to create custom commands. For example, a command that is invoked by saying "My Telephone Number" inserts a telephone number.

What skills and knowledge do I need to write macros?

Some macros are easy to create. For example, global hotkeys and code replacement "macros" (described below) can be tackled by beginners.

Scripting tools such as Macro Express and ActiveWords have steep learning curves, although adventurous novices who persevere will likely have success. AutoHotkey is closer to a programming language than a scripting tool, and may be harder for beginners to learn. On the other hand, its excellent help system contains many code samples that can be copied and pasted.

Macros for automating complex series of steps require intermediate- or advanced-level understanding of Windows® as well as good knowledge of the macro creation tool. A superior understanding of the keyboard interface is essential; macros that move the mouse pointer and click are unreliable. When writing smart macros, rudimentary programming experience is helpful, but not essential.

No special skills are needed to create very basic VBA macros because the macro recorder automatically generates the code. But to capture more than a few simple commands, you must work in the VBA editor and become familiar with the application's "objects" and "object model." If you lack an understanding of objects, you will gain it by the time your first macros are debugged!

Smart Macros

What is a smart macro?

I coined the term "smart" (or "intelligent") macro in 2005 to describe a computer shortcut that is activated either by the user or the user interface (UI), and performs tasks based on feedback that the macro receives from the user, the UI, or both. A smart macro mediates between the user and the computer, makes decisions, and acts on the basis of information it receives from two sources. In contrast, a "dumb" macro is always activated by the user, cannot be controlled once it has been activated (except, perhaps, to halt its execution), and neither detects nor acts upon information from the UI.

Smart macros have a modicum of built-in intelligence. This intelligence increases their flexibility, reliability, and accuracy. Well-designed smart macros dramatically improve software accessibility and usability in ways that cannot be achieved by other means — other than repairing the source code. A smart macro may be so seamless that users may not realize they are interacting with a macro. For smart macros that are triggered automatically or that workaround programming errors, there may be nothing new for users to learn or memorize. Smart macros simplify access to information because the macros themselves assume some of the physical and cognitive effort required to drive software.

What are smart macros used for?

Macros with built-in intelligence have four main uses:

1. Repair accessibility problems

A repair macro fixes an accessibility problem, usually within a specific window or program. For example, the "Options" dialog box contains a text field labelled "Address" (with underlined accelerator "A"), but pressing Alt+A does not move focus to the field. The repair macro, triggered by Alt+A, moves the focus to the text field by sending keystrokes, moving and clicking the mouse, or a combination of the two. This hotkey is available only when the titlebar says "Options," so Alt+A works normally in other windows.

2. Fix usability problems

A macro that fixes a usability problem forces a non-standard application to work the ways that users expect. If, for example, "Save" is F2 instead of Ctrl+S, a program-specific macro can be written to send F2 to the application when the user presses Ctrl+S. Because the macro is program-specific, the hotkey has no effect on other applications.

3. Regulate complex tasks

When automating a task to perform a series of actions, a dumb macro may play back faster than the computer can keep up. The only technique for a dumb macro to control information flow is to pause at critical moments. Macros with time delays tend to be unreliable because pause lengths vary and are unpredictable. This is especially true when a macro interacts with the Internet; network bottlenecks can easily throw off the timing of scripts that are regulated with time delays.

The smart macro's ability to process information from the UI allows for more reliable control. Rather than wait for preset time periods, a smart macro waits for specific events to occur, and tests that the events have occurred before continuing. Events that can be monitored include:

Testing for UI changes makes it possible to detect errors. For example, if a particular window does not appear within 10 seconds, the macro can stop, prompt the user for further instructions, or wait longer.

4. Activate automatically

An automatic macro activates when a specific change occurs in the user interface. Many of the events listed above can serve as triggers. Automatic macros can also activate at set times or at regular intervals.

How do I create smart macros?

Choose any macro software product that supports these four features:

  1. Scope, i.e., macros that work only in certain windows or programs.
  2. Conditional statements, e.g., IF - THEN - ELSE.
  3. Variables.
  4. Event triggers, e.g., macros that recognize when windows or controls gain or lose focus, a specific pixel changes colour, or the mouse pointer changes shape.

At least four third-party products for Windows® can be used to develop smart macros: AutoHotKey, AutoIt, Macro Express, and Macro Scheduler.

"Global hotkeys"

What is a global hotkey?

Windows® allows users to assign about 400 hotkeys for launching applications, opening files and web pages, and opening folders (such as "Recycle Bin," "My Computer," "Control Panel," and "c:\Windows\Desktop"). These hotkeys can be activated at any time, in any program, in any context. They are usually referred to as "desktop shortcuts," but because these shortcuts are always available, I refer to them as "global hotkeys."

When a global hotkey and an application-specific hotkey conflict, the global hotkey takes precedence.

What keys can be assigned?

Most global hotkeys consist of two or three modifier keys (Shift, Ctrl and Alt) plus one other key. Examples of keys that can be assigned include:

Without modifiers

One modifier

Two modifiers

Three modifiers

The following keys cannot form part of a global hotkey:

How do I create global hotkeys?

Follow this procedure to make global hotkeys:

  1. Locate the icon of an application, folder or file. Note: To make global hotkeys for Microsoft Office products, you will need to find each program's executable: winword.exe, excel.exe, outlook.exe, and so on.
  2. Create a shortcut.
  3. Move the shortcut icon to the desktop.
  4. Select the desktop icon.
  5. Invoke its "Properties" page.
  6. Go to the "Shortcut" tab.
  7. Go to the "Shortcut key" edit box.
  8. Press the desired key or key combination.
  9. Press Enter (or click the "OK" button).

The shortcuts do not have be on the desktop. They will work if they are placed in certain folders, but not in others. Shortcuts can be stored in "Start menu | Program Files | Shortcuts."

How can I remember my global hotkeys?

Global hotkeys become second-nature with practice. To help internalize the keystrokes:

Application-specific techniques

What are code replacement shortcuts?

Code replacement shortcuts insert information as you type. The code can be a word, a nonsense word, a number, a phrase, or a series of letters, numbers, and/or non-alpha-numeric characters. After typing the code, the shortcut is activated by pressing Spacebar, Enter, or a punctuation character.

Both Word and WordPerfect have code replacement features, AutoCorrect and QuickCorrect, respectively. Of the two, AutoCorrect is more versatile. QuickCorrect handles plain text and some formatted text; AutoCorrect handles plain text, most formatted text, images, tables, updatable fields, and more. Some (although not all) AutoCorrect features function in other Microsoft Office products. A code replacement shortcut added to Word usually will work in Excel and PowerPoint.

Code replacement is a boon to anyone for whom typing is difficult or awkward, including individuals with upper-body mobility impairments, and people with learning disabilities that affect hand-eye coordination and/or the ability to spell. People with low-vision also benefit because code replacement shortcuts reduce eye-strain. For example, the normal way to insert a symbol into a Microsoft Word document is visually intensive: navigate via a menu to a dialog box, choose the font and a font subset from drop-down lists, find the symbol, select it from an 8-by-24 cell grid, and click the "Insert" button. By creating, say, a two- or three-character code replacement shortcut for the symbol, eye-strain is eliminated.

There are many creative ways for improving computer access with code replacement shortcuts. The following descriptions and chart illustrate five different techniques:

1. Correct misspelled words

This technique works well with people with learning disabilities, and other individuals who, for whatever reason, frequently mistype certain words.

2. Abbreviate words and phrases

Rather than repeatedly type long words and expressions, substitute short codes.

3. Insert symbols and foreign characters

Simplify the insertion of the foreign characters and symbols you use regularly.

4. Repair capitalization

Eliminate the need to press the Shift-key when entering acronyms, words with unusual capitalization, and words and phrases containing alternate "upper" characters such as ! and @.

5. Insert images and formatted text

Enter chemical formulas like H2O and mathematical expressions such as ex on the fly. Use the same technique to insert images, tables, tables of contents, and fields.

Five code replacement techniques
Technique Code Replacement
Correct misspelled words untill until
mispell misspell
Abbreviate words and phrases px peroxide
!!! 1-555-555-1212
sss Sandy S. Smith
myemail sssmith@pencilpusher.com
myletter Thank you for your recent letter.


Sandy S. Smith
Insert foreign characters and symbols e/ é
L= £
[pi] π
Fix capitalization alberta Alberta
autocorrect AutoCorrect
ibm IBM
phd Ph.D.
Insert formatted text and images h2so4 H2SO4
table3x2 Image of a 3-cell by 2-cell table.
ourlogo White, Black and Clear Attorneys
25 Grace St., Suite 200, York

What about built-in macro languages?

Some applications have built-in programming interfaces. The programming language for Office, Visual Basic for Applications (VBA) is a subset of the Visual Basic (VB) programming platform. Whereas VB is designed to create stand-alone applications, VBA is designed to customize existing applications. Both VBA and VB are Microsoft products.

The built-in macro language for Corel applications is PerfectScript. Beginning in 1999, however, Corel has licensed Microsoft VBA for use with WordPerfect and several other Corel products. PerfectScript continues to be supported as a macro language for Corel products.

VBA can be used to build custom commands, repair accessibility problems, and develop usability enhancements in word processors, spreadsheets, database managers, e-mail applications, and presentation software. Not all programs offer VBA support. For example, VBA works with Outlook, but not Outlook Express. The application with the best VBA support is Microsoft Word.

Recording vs. authoring Word macros

There are two ways to create Word macros. Capture them using the macro recorder, or enter them directly in Visual Basic for Applications. The recorder cannot capture certain mouse movements (e.g., text selection via mouse), and recorded macros tend to replay slowly. They are also somewhat unreliable.

Macros coded directly in VBA, however, execute quickly and can be made extremely robust. A good way to learn VBA is the hybrid approach: record macros, and then study and edit the code. The VBA help system is excellent, and contains code fragments that can be copied and incorporated into new commands.

  1. Choose a task to perform in Word. Before beginning, ensure that you know exactly how to perform the task. If a task involves selecting text, you must use keyboard commands.
  2. Start recording. Select "Tools | Macro | Record New Macro..." Name the macro. Assign a keyboard or toolbar shortcut.
  3. Record the macro. Perform the task without making mistakes.
  4. Stop recording. Click the "Stop" button on the "Stop Recording" toolbar, or select "Tools | Macro | Stop Recording."
  5. Test the macro.
  6. Study and refine the code. Press Alt+F11 to open the Visual Basic for Applications editor. Use the Help system to learn about the code and the structure of the language.

What are your questions?

Feel free to submit your questions. Any comments about this FAQ are welcome.


A special thank you to Jane Berliss-Vincent, Dean Martineau, Neville from Australia, Frank Ibarra, and Paul Makulski for their important contributions to this FAQ. I also thank the hundreds of people who have attended my lectures, hands-on workshops, and web-casts on macros and macro techniques. Your questions and comments have helped to refine my understanding of the usefulness and power of macros.


The information contained in this FAQ is intended as a guide only. It is current to the best of the author's knowledge, having been compiled from sources believed to be reliable. No warranty, guarantee, or representations are made by the author as to the absolute correctness or sufficiency of any representation contained in this FAQ.

Trademark information

Microsoft, Windows, Word, Excel, Outlook, Outlook Express, Notepad, Visual Basic, Visual Basic for Applications, and Internet Explorer are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.

"Windows Macros FAQ" is an independent publication and is not affiliated with, nor has it been authorized, sponsored, or otherwise approved by Microsoft Corporation.