Word Macro – How To Create/Delete A Word Macro Using VBA?

Earlier we covered an article on Word Macros and steps to create a Word Macro using the inbuilt macro recorder.Macros Recorder is useful for and Microsoft Word user, who wants to create a Word Macro without writing any code. But you may create a macro using Visual Basic for Applications (VBA) as well.

Not all Word macros can be created using the macro recorder.Also, there may be instances where you might want to edit a macro for a minor change, rather than recording (creating) it all over again.These are situations where you may create a word macro using Visual Basic for Applications (VBA). However, you may need to to have some programming knowledge for you to create or edit a macro in VBA. Hence the following steps may be useful for advanced users to create, edit or delete a Word Macro.

How To Create a Word Macro in MS Word 2007?

If the developer tab is not enabled in Word 2007, enable it by following the steps below:

  • Click the Microsoft Office Button , and then click Word Options.
  • In Word Options Window, Click Popular.
  • Under Top options for working with Word, select the Show Developer tab in the Ribbon check box

Then follow the steps mentioned below to open and edit the macro code in Microsoft Word’s VBA editor:

  • On the Developer tab, Click visual Basic (or press Alt + F11) to launch the visual basic editor.
  • On the Tools menu, point to Macro, and then click Macros.
  • In the Macros in list, click the template or document in which you want to create or edit the macro. If you want the macro to be available to all Word documents, and not just the current document, click on Normal
  • In the Macro name box, type a name for the macro and Click Create to create a new macro. To edit an existing macro, choose it and click Edit
Creating a Word Macro using VBA
  • In the main editing panel, be sure the left pull down menu at the top of the work area reads “General“. If it doesn’t, change it to this option.
  • Paste or type your macro code into the editing area. You may notice that the editor changes the color and spacing of our code in order to make it uniform and easier to read.
  • Use the File–>Save (or press Ctrl+S) command to save your macro code and return to your document.
Word Macro

How To Delete a Word Macro in MS Word 2007?

To delete a Word Macro,

  • On the Developer tab, Click Visual Basic (or press Alt + F11) to launch the visual basic editor.
  • On the Tools menu, point to Macro, and then click Macros.
  • In the Macros in list, click the template or document from which you want to delete the macro
  • Choose the macro you want to delete and click Delete

That is all about creating and deleting a Word Macro.

Leave a Reply

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

*

Recommended Videos

Word Macro: Delete Button and ActiveX Controls vba
Word Macro: Delete Button and ActiveX Controls vba
How to Open, Navigate and Edit Existing WORD Doc Using Excel VBA! Comprehensive guide
How to Open, Navigate and Edit Existing WORD Doc Using Excel VBA! Comprehensive guide
VBA Macro to Delete Rows Based on Cell Values
VBA Macro to Delete Rows Based on Cell Values
Save as Macro Enabled Document DOCM Functional Checklist Survey in Microsoft Word 2010 (part 3 of 9)
Save as Macro Enabled Document DOCM Functional Checklist Survey in Microsoft Word 2010 (part 3 of 9)
Word Macros Tutorial
Word Macros Tutorial