YOURS TRULEIGH EDITING
  • Home
  • Services
  • Portfolio
  • Testimonials
  • Contact
  • Blog

12/1/2021

Word: How to install a macro

0 Comments

Read Now
 
There are (at least) a couple of ways to install a macro. I will talk you through what is probably the most straightforward method later in this post, but first let us look at what a macro looks like inside Word’s Visual Basic for Applications (VBA) editor. (I'm going to skip the 'for Applications' bit for simplicity.)

​What do macros look like?

This is what the SmallCaps macro that we recorded in this post looks like in the Visual Basic editor:
Picture
All macros have the same basic structure:
  • They start with Sub MacroName()
  • There is some information about the macro (in green type, starting with single quote marks). This information doesn’t affect what the macro does – it’s just a way that you can add notes, if you feel so inclined
  • The main part of the macro (black font) contains the instructions
  • The macro ends with End Sub.
This is what the PatientsWith macro from this post looks like:
Picture
​You can see that it has the same structure as the SmallCaps macro, but there are fewer instructions in the body of the macro. 

​How to install a macro

First, go to View Macros in the Macros section of the View tab. (See the first part of this post if you’re not sure). When you click on View Macros you get a pop-up box which looks like this:
Picture
Type the name of the macro that you want to install into the top box (underneath Macro name:). I am calling my new macro TestMacro. Remember: macros are a throw-back to the old days of file naming systems so you can’t use spaces!
Picture
When you have typed the name in, click on ‘Create’. This will bring up the Visual Basic editor (which is what we were looking at earlier). Clicking on 'Create' for my new macro, TestMacro, gives me:
Picture
You need to copy the body of the macro you are installing from the source document (this will probably be a web page or a Word doc) and paste it below the green quote marks and above End Sub (the cursor should automatically be in the correct place).

​For my PatientsWith macro, the part that I need to copy and paste is:
​Selection.Cut
Selection.MoveRight Unit:=wdWord, Count:=1
Selection.TypeText Text:=" with "
Selection.PasteAndFormat (wdFormatOriginalFormatting)
My new macro – called TestMacro – will then look like this:
Picture
It’s important that you are careful to paste your text exactly where it needs to go. You will find that the Visual Basic editor automatically creates lines between each macro in your list of macros. Be careful not to delete these lines. 
​
*** Only copy and paste macros from sources that you trust. Macros are powerful and there are macros which are able, for example, to delete all your files if you run them. ***
​
You then need to save your macro in the Visual Basic editor, using the Save icon at the top left-hand side. 
Picture
​Then close the editor (via the File menu or the cross on the top right-hand side). When you open your list of macros, it should now contain your new macro:
Picture
Type a description of what your macro does in the 'Description:' box at the bottom.

Alternatively, if you have copied a complete macro (from a trusted source), you can click on 'Edit' in this pop-up box:
... which will bring up the Visual Basic editor. Scroll right down to the bottom, and paste the macro text below the bottom line in the editor. Save and quit like I described above.
Picture

Go back to:
Macro baby steps part i

Author

Andrea at Yours Truleigh Editing.
www.yourstruleighediting.com

Picture

Archives

October 2021
August 2021
July 2021
June 2021
March 2021
February 2021
January 2021
December 2020

Categories

All
Beginner
CIEP
Editorial Training
Intermediate
Macro Baby Steps
Macros
PDF
PerfectIt
StetSwim
Word Basics
Word Styles
Working With Word

Share

0 Comments

Your comment will be posted after it is approved.


Leave a Reply.

Details

    Author

    Andrea at Yours Truleigh Editing
    I'm an editor based on the south coast of the United Kingdom. I try and use the tools at my disposal to make the process of editing as effiicient and accurate as possible and I'm hoping to share some tips and techniques that I've picked up along the way. I'm an enthusiastic and grateful member of the Chartered Institute of Editing and Proofreading. Editorial freelancers benefit hugely from being part of supportive organisations:  for direct support for our work, such as training and providing routes for our clients to find us, but also for community, which is needed now more than ever. 
    Please note: all Word tips are based on Word 365 for PC. 

    Archives

    December 2021
    October 2021
    August 2021
    July 2021
    June 2021
    March 2021
    February 2021
    January 2021
    December 2020

    Categories

    All
    Beginner
    CIEP
    Editorial Training
    Intermediate
    Macro Baby Steps
    Macros
    Music
    PDF
    PerfectIt
    StetSwim
    Time Off
    Word Basics
    Word Styles
    Working With Word

    RSS Feed

Dr Andrea Kay
​Medical Editor | ​Yours Truleigh Editing

© COPYRIGHT 2023. ALL RIGHTS RESERVED.
  • Home
  • Services
  • Portfolio
  • Testimonials
  • Contact
  • Blog