Home Word 2007 Macros Work Faster With Macros: Part II
Search MS Office A-Z   |   Search Web Pages/ Design A-Z

Work Faster With Macros: Part II

Last month we introduced you to macros and showed you the process for creating a simple one. This month we look at a more complex example: an empty, formatted table for holding recipe ingredients. We want to be able to use this macro anywhere in the document when we come to a place where we want to list ingredients in a table.

As we said in the first column on macros, every action you take will become part of the macro. If you’re creating a complex macro, you may want to plan out your moves in advance.

Start Your Engines

Create a new document. Go to the View tab on the Ribbon, click the bottom half of the Macros button, and select Record Macros. Type Recipe_Box in the Macro Name box and write a short description of the macro in the Description box if you wish. Click OK. Don’t worry about assigning the macro to the Quick Access Toolbar or a keyboard shortcut right now.

Let’s create a table with 12 rows, which should provide spaces for enough ingredients in most cases. We want two columns, one for the name of the ingredient, the other for the quanity. You can add or subtract rows to the table later as needed after you run the macro.

On the Insert tab of the Ribbon, click the Table button and then the Insert Table option. Type 2 for the number of columns and 12 for the number of rows. Click OK. The table appears in the document.

Unfortunately, when the Record Macro function is running, you can’t right-click the mouse to bring up the context-sensitive menus. Neither can you use the mouse to click and drag to resize the table. Instead, you can use the Ribbon and dialog boxes. Click the Design tab under Table Tools. In the Table Styles area, find and then click Light Shading - Accent 2. (When you use a Table Style, you need to apply it first, and then modify it. If you apply it later, it may erase some modifications you have made.)

Now click the Layout tab and click Properties in the Table group. This brings up the Table Properties box. We can make several adjustments to our table here, all at once. Click the Table tab and then the Borders And Shading button at the bottom. Place a border around the table by selecting the solid line (at the top of the Style list) and make sure that the Width is 1. On the left, click Box, and then on the right, click the button that has a line running down the middle of its icon. The thumbnail shows a preview of what the border will look like. Click OK. Back on the Table tab, click the Left and Around buttons. This will cause text to wrap around the table.

Adjust Column Sizes

Now we will change the column sizes because we want the first column, called Ingredients, to be wider than the second, called Amounts. Click the Column tab. At the upper left, the dialog box should say Column 1, because that is where the cursor is. If it doesn’t say anything, click another tab and then click back. Type 3 in the Preferred Width box. Now click the Next Column button (now it should say Column 2 in the dialog box), and type 1.4.

Click OK and the table should show the new column widths as well as the borders. The second column may still be selected. Deselect it by pressing the TAB key. Type the words Ingredients and Amounts in their respective places. Press the arrow keys to move among the cells of the table.

Click the blue square Stop button on the status bar at the bottom of the Word 2007 window to finish the macro. You now have a macro that will place a custom formatted table wherever you want.

To add the macro to the Quick Access toolbar, first click the Office Button, Word Options, and Customize. In the Choose Commands From drop-down box, choose Macros. Choose the macro you created and add it to the Quick Access toolbar. You could also click the Customize button at the bottom of the screen to create a keyboard shortcut



Home Word 2007 Macros Work Faster With Macros: Part II
Search MS Office A-Z   |   Search Web Pages/ Design A-Z