From the course: Word 2016 Essential Training

Creating and running a macro

From the course: Word 2016 Essential Training

Start my 1-month free trial

Creating and running a macro

- In this chapter, we're going to concentrate our focus on functionality that will help you to work more efficiently. We're going to begin with Macros. Now, if you've ever found yourself repeating the same steps, over and over, for multiple documents, or maybe adding the same content, well, you might consider recording a Macro. So you'll do it once and never have to do it again. Just play it back. That's what we're going to do with our press release document here, LH_press_release1001. And we're going to scroll all the way down to the bottom of the second page, and let's say typically we click down here at the bottom of the page and we start typing out closing information on how to book a room or an event at Landon Hotels. Well, instead of typing it out, because we do it over and over again, we should record what we're doing first and then simply play it back every time we need it. To do that, we need to see the Developer tab on the ribbon. My last tab is the View tab. You may see your Developer tab if it's been turned on, but if it's not turned on, like me, let's go to the File tab, select Options, and click Customize Ribbon. Over here on the right hand side, you can see the main tabs. My Developer tab is not checked off, so I'm going to click the check box to turn it on, and click OK, and now I have my Developer tab. Click that tab, and you're going to see, over here on the left hand side in the Code group, Macros. Now, there are other things we can do here in Word 2016, like scripting with Visual Basic, but we're going to focus on Macros, and there's the Record Macro button to allow us to record everything we're about to do. So let's click there to start the recording. We get to give it a name. I'm going to call this PressReleaseClosing, like so. So this is going to go at the bottom of every press release. Notice I'm not using any spaces or fancy characters. That's important when naming your Macros. Next, we get to choose if we want to assign this Macro to a Button or create a Keyboard shortcut. We don't have to, but maybe a Keyboard shortcut would be nice. Let's click Keyboard, which opens up a Customize Keyboard dialog, and the cursor's flashing under Press new shortcut key. So all we have to do is choose our shortcut key. How about something like Alt+Shift+C, as in Closing? Well, as you can see, that's currently assigned to something else, ClosePane. So I'm going to hit my Backspace key to take that out and try something else. Well, it's all about booking information, so Alt+Shift+B. And we could use Control+Shift, we could use different combinations of booster keys, but it looks like Alt+Shift+B is unassigned, so we can use that one. Click Assign, and click Close to go back to recording our Macro. Notice your mouse pointer looks a little bit different, has a cassette tape attached to it. Looks like anything we do now is going to be recorded, including any mistakes we made, so we'll want to be careful. Let's start by going to the Home tab, and choosing center alignment. Notice the cursor flashing in the center. Next, we'll choose a font color. We want to use the same color for all of our closings. I'm going to go with this nice, dark purple down here, so it's actually a Blue, Accent 3, Darker. Let's go over to the next one, yeah, that one's better, Purple, Accent 4, Darker 25%. So we changed a couple of things. Now it's just a matter of typing, and everything we type is also going to be recorded. To book a conference room or event, please visit our website at www.landonhotel.com, or give us a call at, I'm going to type in, 555-555-5555, like so. And that's all we need, so we can stop recording now. Let's go back to the Developer tab. Notice that we could Pause Recording if we needed to do some things that we didn't want recorded, and then come back to it by continuing with the recording, but when we're done, here's where we go, Stop Recording, give that a click. And you've just created your Macro, which means you'll never have to do this again. So I'm going to go over here to the left margin, click and drag down to select that entire last couple of lines, and use my Backspace key to take it out, Backspace again. And as you can see, my cursor's flashing down at the bottom of my press release. So let's just say we've completed our press release and we're ready to add that information. There's a couple of things we can do now. We can go to the Macros button here on the ribbon, with the Developer tab selected, and you'll see a list of all the Macros you've created, so far just the one, PressReleaseClosing, and we click Run to run it. There it is. All right, let's delete that again. I'm going to use my Backspace key a couple of times. And the other option, because we created a Keyboard shortcut, is to do that, Alt+Shift+B. You can see that's a lot faster than having to add it and format it every time we create a press release. Now, of course, if there were something that needed to be changed, maybe we did make a mistake and created a typo, or maybe the phone number is going to change. Well, we can always edit Macros as well. We'll do that next.

Contents