May 29

Print this Post

Explain what is a macro? – Concept of the day.

A macro is a series of keyboard strokes recorded by an application. These keystrokes often represent commands within a piece of software which are combined to reduce the work needed to perform the functions. Macros are then stored within the application to allow for repeated use.

When recording a macro within an application like Microsoft Word, the keyboard strokes or commands get bound to a shortcut key or stored within a toolbar making them accessible via the mouse. Then the saved sequence of commands can be executed simply by clicking a tool bar button or pressing the assigned keys.

Suppose a Microsoft Word user was looking for a quick way to save a document and then exit Word. This could be recorded within a macro to combine the save action and the exit action as follows using Microsoft Word 2003:

From toolbar select “Tools>Macro>Record New Macro” .Once the record macro object has been clicked, a dialog box appears which allows the user to provide a name for the macro and to assign the toolbar button or keyboard shortcut that will trigger the macro. Usually when assigning a keyboard shortcut for a macro, the control, shift, or alt keys are pressed in combination with the key being assigned. The modifier keys, control, shift, and alt, can also be pressed together in any combination with a key. The idea is to keep the macro keyboard strokes as simple as possible to allow for easily repeated use.

Now : (1) Enter a name for the macro (2) Assign the keyboard strokes or tool bar selection that will trigger the macro, for this example choose Ctrl + Alt + X (3) Click OK

Then the actions which will make up the macro need to be performed so they can be saved. In the example provided here,we should select File option from toolbar and then save the document , followed by closing the document using ‘Exit’ in the ‘File’ option.

After the actions have been performed, the user would select the stop recording option from the Tools>Macro>Stop Recorder. This would prevent further actions from being recorded and save the macro for future use.

Once a macro has been created, it can be used to quickly perform the saved sequence of commands assigned to the shortcut key. In our save and exit example, pressing Ctrl + Alt + X will save the current document and exit the Microsoft Word application.

Another thing to keep in mind when assigning shortcut keys is to be careful not to overwrite selections already in use, like Ctrl + S which controls the Save action by default. When a key combination is tried, the existing action is displayed to let the user know that the keyboard strokes they are trying to use for a macro are already used by the application. It is always best to combine Ctrl with Shift or Alt when assigning keystrokes to a new macro to avoid removing existing useful macro shortcuts.

About the author


Permanent link to this article: http://www.explainstuff.com/2009/05/29/explain-what-is-a-macro-concept-of-the-day/

1 comment

  1. Marry

    I like the way you write! Nice blog.

Leave a Reply