September2010: What's in the breeze Writing web content for several different companies Proofreading a technical user manual for a client Writing articles on the industrial sector for a client on a pay-per-month basis Writing white papers for a client in the knowledge management industry Writing news articles for a client on a daily basis Developing content for corporate case studies for a client Providing services of an editorial assistant on a per month basis Providing services of a research assistant on an hourly basis Repackaging web content for a client... and more
Check out sample articles written by writers from our network.
Writers, use the writers' contact form to get in touch with us.
There may have been many instances where you have had to perform routine tasks repeatedly in a document. For example, while working on a project report you may need to write a biography of each individual that you interview on every page. You also need to affix the individual’s photograph and type the name in a particular style and position. You have to affix the photograph on the left margin and wrap the text to the right of the photograph. Imagine repeating the same task for the dozen or so individuals you want to profile!
Now, what if you could automate this task by simply clicking a button on the toolbar? The Macro tool allows you to do just that. With the help of a macro you can record your keystrokes and mouse operations as a series of commands to be played back at a later time. Just like a well-orchestrated symphony!
There are several advantages of using macros:
? It automates repetitive and tedious tasks such as formatting.
? It enables you to work more efficiently and complete your work faster.
? If a macro is recorded correctly, it reduces the possibilities of errors in your documents.
Remember that there are over 900 commands available in Word, some of which are assigned to menus and toolbars. Therefore, you need to ensure that the macro you are creating is not already available. To view the list of available macro commands in Word:
1. Click Tools on the menu bar.
2. Select Macro and then Macros from the submenu. The Macros dialog box appears.
3. Select Word commands in the Macros in drop down box. An alphabetical list of all commands is displayed in the Macro name box.
4. Select a command name. On selecting a name, a description of the
command appears in the Description box.
If the macro that you want to create is already listed, do not create another one. If you give a new macro the same name as an existing command, the actions of the new macro will replace the existing actions.
Creating a Macro
Once you have decided which macro you want to create, you need to prepare in advance before you actually begin its creation. You need to:
? Ensure that you have your steps memorized. This is important as the recorder will record each keystroke or mouse operation and include it in the macro.
? Ensure that you know the shortcut keys for the commands. This will help you save time while recording and creating a precise macro.
? Ensure that you use minimum steps to develop a leaner macro.
? Ensure that you carry out a test run of the macro before recording it.
You can create a macro in two ways:
? By recording steps
? By using Visual Basic Editor
Creating a Macro by Recording Steps
To create a macro by recording steps:
1. Click Tools on the menu bar, point to Macro, and click Record New Macros. The Record Macro dialog box appears.
2. Type a name for your macro in the Macro name box.
Caution: While assigning a name to your macro, ensure that the name does not have any spaces or symbols. For example, you cannot name your macro as New Template.dot. The correct name would be NewTemplate.dot.
3. Select the document or template in which you want to store your macro in the Store macro in box.
Note: Word makes your macro available to all documents by default.
4. Type a description for your macro in the Description box.
5. Click Toolbars if you want to assign the macro to a toolbar or menu. The Customize dialog box appears.
6. Click the Commands tab.
7. Select the macro you are recording in the Commands box and drag it to the toolbar or menu you want to assign it to.
Optionally, if you wish to assign the macro to shortcut keys, click Keyboard. The Customize Keyboard dialog box appears. In the Commands box, click the macro you are recording. In the Press new shortcut key box type the key sequence. Save the Macro in the desired file and then click Assign.
8. Click Close to begin recording the macro. You will notice a Record Macro toolbar on the upper left corner of your screen and the mouse pointer will have a small icon that indicates that your actions are being recorded.
9. Perform the actions you want to include in your macro. Press the Pause
button if you wish to pause your recording.
Note: While you can use the mouse to click commands and options, the macro will be unable to record mouse actions in a document window. Therefore, you need to use the shortcut keys for actions such as selecting, copying, or moving text.
10. Click the Stop Recording button to stop recording your macro.
Creating a Macro Using VBA Editor
You can also create a macro by using a Visual Basic Applications (VBA) Editor. In fact, all macros are actually Visual Basic subroutines. A macro begins with the word Sub, the name of the macro, followed by parentheses, and ends with the word End Sub. Everything else in between is part of the code. For example:
Sub NewMacro( ) Selection.TypeText Text:="Word
Processing" End Sub
Note: The VBA Editor helps you to create and edit macros without requiring any programming knowledge.
To create a macro using VBA Editor:
1. Click Tools on the menu, point to macro, and click Macros. The Macro dialog box appears.
2. Type a name for your macro in the Macro name box.
3. Select the template or document in which you want to store the macro in the Macros in box.
4. Click Create to open the VBA Editor. Alternately, click the Macro name and click Edit. The document that appears contains your macro.
Note: Word stores all macros in templates. Any macro that you create is stored by default in Normal.dot, which is a global template. If you wish to store the macro in a specific document, save the macro in that particular document.
Caution: Save a copy of your template before beginning any editing of macros. A small error could render your macro useless.
Assigning Keyboard Shortcuts to a Macro
So, you have created a macro or macros to help you work faster on your documents and do away with repetitive tasks. However, in your quest to save time you actually end up creating half a dozen macros! You surely don’t want to waste time searching for these macros in the Macros dialog box, do you?
What can you do? You can assign a keyboard shortcut to your macro. That way, you can simply run your macro with the click of a mouse or by pressing a shortcut key.
To assign a shortcut key to a macro:
1. Click Tools on the menu bar, and click Customize. The Customize dialog box appears.
2. Click Keyboard. The Customize Keyboard dialog box appears.
3. Scroll down the Categories box.
4. Select Macros.
5. Select the macro to which you want to assign the shortcut key in the Macros box.
Note: If the macro has a keystroke assigned to it, the keystroke will appear in the Current keys box.
6. Type the new shortcut key in the Press Shortcut key box if no shortcut key has been assigned to the macro or if you want to create a second shortcut key for your macro.
7. Click Save changes in box to save your changes. If you wish to apply the changes to all Word documents select Normal from the drop down list. However, if you wish to use the shortcut key only in the current document, select the document name from the list.
8. Click Assign, and then click Close.
Running a Macro
Once you have assigned a shortcut key to your macro, you are now ready to run the macro. To run a macro:
1. Click Tools on the menu, point to Macro, and click Macros. The Macro Name box is displayed.
2. Click the name of the macro you want to run.
3. Click Run.
Alternately, you can also press the shortcut key to which the macro is assigned.
Setting the Macro Security Level
Sometimes you may be unable to copy macros from one document to another or transfer files that contain macros from one computer to another. One of the reasons why this may happen is that Word by default sets its macro security level to High to ward off macros with viruses or from suspicious sources. To change the macro security level:
1. Click Tools on the menu bar, and click Options. The Options dialog box appears.
2. Click the Security tab.
3. Click Macro Security. The Security dialog box appears.
4. Click the Security Level tab.
5. Select the security level you want to use.
Caution: Do not set the security level to Low because viruses travel fast at times and you may not catch them even with your anti-virus software. Therefore, set the security level to Medium where Word will prompt a warning before allowing you to use the macro.
Creating a Macro to Format Text
If you frequently need to work on a document that requires heavy formatting, create a macro. Creating a macro to format your document is quite simple:
1. Select a section of the document where you want to apply the formatting.
2. Turn on the macro recorder.
3. Carry out the formatting tasks.
4. Turn off the macro recorder.
5. Select the text to which you wish to apply the formatting before you run your macro. The changes are applied to the selected portion only.
Run the macro. Any text that you now enter will retain the formatting.
Out of 5 “chilies”, our editorial team gave this article...
—About our writer:
Radhika Das writes for Chillibreeze.
>> Read more articles written by Chillibreeze writers: