✕
Share it

Contact me
iPhone / iPad

Tools

Hindi Proof Reader Top Tech Blogs in India QR Code Generator
Make Money Online Earn from Blogging More Tools MS-Excel MS-Word AdSense About Lalit Contact us
TechWelkin Site Logo

TechWelkin

Tips and Tutorials on Computers, Mobiles and Internet

Last updated: 31 July 2017

How to Record, Write and Run a Macro in MS Word

September 18, 2012 By Lalit Kumar 1 Comment

Basic steps for recording, writing and running a macro in MS Word. The same steps apply for other applications in MS-Office package.

Before we learn how to write macro in MS Word, let’s understand what exactly is a macro. Well, macro is a set of instructions which automatically execute sequentially (one after the other). For example, sometimes you repeatedly do several tasks, like selecting all the text in document (with CTRL + A), then making it all italic (with CTRL + I), then go to font formatting and make all this text as blue. You can record these three tasks in a macro and then give this macro a name. Afterwards, you would just need to run this macro and all these three instructions will be automatically executed.

You can make macros in two ways. If you just want MS Word to track and record your actions, you can Record a Macro. Secondly, if you need to write more complex instructions, you can program a macro. Let’s look at both of these options.

Record a Macro in MS Word

MS Word (and all other software in MS Office package) allow you to record your actions and then execute them as a single command. Before you begin recording of a macro, I would suggest that you become very sure what you want to do and how you want to do because every action of your will be recorded in macro. Let’s understand it by an example:

  1. Open a document and begin recording a macro. Now you take the following steps:
  2. Select all text in the document (by pressing CTRL + A)
  3. Make all the selected text italic (by pressing CTRL + I)
  4. Make all the selected text orange  (OOPS! But, you wanted to make it blue!)
  5. You again select the text (by pressing CTRL + A)
  6. Make all the selected text blue
  7. Stop macro recording.

Macro will record all these steps. You can not remove step 4 and 5 from the macro recording. When you will run this macro, you’ll get all the desired result but macro will also go through step 4 and 5… that is to say that the macro will make the same mistake as you did and then it will correct the mistake just the way you did.

Did you get the point? Once you start recording a macro, ALL of your actions are recorded irrespective of whether they are wrong or right.

That is why you it is better to decide what exactly you want to record. If macro recording is going to be long, it is advisable that you practice the steps to perfect them before beginning the recording.

To record a macro, open the MS Word document and go to View menu. There you’ll see Macro option. Clicking on this will give you option to Record Macro.

When you choose to record a macro, MS Word will ask you to give the macro a name. This name will identify the macro for running it.

Once recording is done, go back to View > Macro > Stop Recording to end the recording.

How to Run a Macro

Having done with recording, now it is time to see how your new macro works.

Go to View > Macro > View Macros

Macros box will open. Select the name you’ve just given to your macro. And then click the Run button.

You’ll see that MS Word will execute all the actions that you had recorded.

Our tips on MS-Word make your life easier and increase your productivity at work.
How to Write a Macro

If you’re a programmer, you can also write more complex instructions to be executed as a macro. But first, you may want to see an example. With VBA macro for MS Word, for example, you can do multiple find and replace operation in one go.

Now here is how you can write a VBA macro:

In order to write a Visual Basic program to run in MS-Office packages (like Word, Excel, PowerPoint, Access etc) you need an editor. Microsoft has provided you with one. To bring this editor to the fore take the following steps. Here I assume that you are working in MS-Word.

In Word 2007 and above, click on the Office button (round orb like button in top left corner) and then click on the Word Options button given at the bottom of the menu.

A dialog box will appear. Go to the Popular tab and select the “Show Developer tab in the Ribbon” check box. Click OK.

SEE ALSO: My compilation of MS-Word Tips and Trick

Now on the ribbon, you will see Developer tab. Go to this tab and you will see a button to launch Visual Basic Editor.

In the Editor, you can start a new module and write your code in there. Then save the module. Remember, VBA modules created in Word are saved as documents.

Once you have written and saved the module, you can run it by opening the saved document and going to the View tab on ribbon. Then go to Macros button and select View Macros. A list of macros associated with the document will appear and you can select and run the macro you desire.

This was all the basic information about how to record, write and run a macro in MS Word. Please let me know if you have any question about this topic. I will be glad to try and help you. Thank you for using TechWelkin!

Related Articles for More Information:

  1. Multiple Find and Replace in MS Word Using Macro
  2. Microsoft Word Shortcut Key Combinations
  3. Replace Line, Paragraph, Carriage Break in MS Word
  4. MS Word: Change Smart Curly Quotes to Simple Ones
  5. Photoshop: Write Circular Text and Text Around Other Shapes
  6. How to Remove Leading and Trailing Spaces in MS-Word
Last updated: 31 July 2017 | Published on: 18 September 2012 | Authored and Edited by: Lalit Kumar and Team | Filed as: Home » Software » MS-Office » How to Record, Write and Run a Macro in MS Word

Filed Under: MS-Office

Lalit Kumar is the Principal Author and Founder of TechWelkin. He is a web explorer and he enjoys finding useful information on the Internet. He loves to put things together to create a bigger solution. Lalit is passionate about technology, languages and literature. You can contact Lalit via email (techwelkin [at] gmail [dot] com) or Facebook (facebook.com/techwelkin).

Comments

  1. suresh k says

    April 3, 2018 at 2:36 pm

    I have word doc contains alphanumeric words where as I want to do superscript and subscript for numeric i.e., example word is like this “adcf123 nmesc456” want to conver the 1 is superscript and 2 is subscript and 3 is again superscript and 4 is superscript and 5 is subscript and 6 is superscript. This should be done without highlighting automatically. If it is possible please provide the solution.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Stories

  • Check Ticket Confirmation PNR Status on WhatsApp
  • Easily Capture Screen and Do Recording on iPhone / iPad
  • Consistent Video Upload is Important for YouTube Channel
  • Conditions for YouTube Channel Monetization
  • How to Get Your First 100 and 1000 Subscribers on YouTube
  • What is the Average Audience Retention for YouTube Channels?
  • Remove Activate Windows Watermark from Windows 10
  • Disadvantages of Using Google Custom Search Engine

Tools

  • Hindi Proof Reader
  • Top Tech Blogs in India
  • QR Code Generator
  • Random Word Generator
  • Strong Password Generator
  • Trace Mobile Numbers

Connect with us

  • Facebook
  • Google+
  • Twitter
  • LinkedIn
  • Pinterest
  • RSS Feed

© 2007-2019 TechWelkin.
The content is copyrighted to Lalit Kumar and may not be reproduced on other websites.
TechWelkin displays Google AdSense ads. See how Google uses data when you're on TechWelkin | Privacy Policy