Macros and VBA

ADD Balance - trademark of Charles Kenyon, Attorney at Law and Webmaster. Frequently Asked Questions - Help
Microsoft Word - Frequently Asked Questions - click to go to the question list.

on ADD Balance by Madison Wisconsin Criminal Defense Lawyer Charles Kenyon

Many people visit this site and use the information it contains. It costs money to keep on line and effort to update.
If you have received assistance here
please consider making a donation if you can.

 
Thank you. Charles Kenyon

Thank you for the suggestions. ("Smilies" from Woody's Lounge.) Click to go to Lounge. with input and suggestions from many on Thank you for the suggestions. ("Smilies" from Woody's Lounge.) Click to go to Lounge.
the Microsoft Newsgroups and at Woody's Lounge 

Click here to skip past FAQ questions list and other info and go directly to the start of this topic.

Search the FAQ site on Google.

Remember to Refresh your page. [F5].

Home
Word Tutorial - Intermediate
Legal Users Guide to Word
Downloads
Books about Microsoft Word - Newsgroup suggestions
Links
Web Resources for Microsoft Word

 

Using Date Fields in Microsoft Word
Calculated Dates
Booklet Formatting and Printing in Microsoft Word
Changing the Default Font in Microsoft Word
Document linked to Printer in Microsoft Word
Fonts Missing from Menu in Microsoft Word
How can I get a different header / footer on the second page?
Heading? Header? Microsoft Word Help
More on Headers and Footers in Word
Letterhead
Mapped Content Controls and Document Properties
Weird Lines and Borders
Macros and VBA
Master Documents Feature in Microsoft Word
A Back CoverPage in Microsoft Word
Normal Template in Microsoft Word - How to Open or Find the Normal Template
My docs open in the wrong program! Re-registering Word using the commandline.
Moving (Sharing) Customizations in Microsoft Word
Global StyleSheet?
MVP means?
Naming Files - A System is the Key
Posting tips in the Microsoft Word Forums
Getting rid of that (*)#"@^ paperclip! - Taming the Office Assistant
Page X of Y doesn't work in Microsoft Word!
Save Changes to the Global Template? Keeps Popping Up
Templates in Microsoft Word
Global Templates
Too Many Icons on the Taskbar in Microsoft Word 2000
Getting Rid of the Web Toolbar in Microsoft Word
Word for Word Perfect Users
Favorite Documents Menu
Work Menu in Microsoft Word
Templates Menu in Microsoft Word
What books have been recommended about Microsoft Word?
Where can I find more templates?
Word Links

 

I see a macro in a newsgroup that 
I would like to try. 
How do I add it to my template?

 

This page last revised: 13 Dec 2017 05:24:01 -0600 .

The 10 point "idiots' guide"This is a joke, son. More smiles available. to installing news group macro listings is as follows: 

Let's use the macro to update all the fields in the document as an example.

 

Sub UpdateAll()
Dim oStory As Range
Dim oField As Field
On Error Resume Next
For Each oStory In ActiveDocument.StoryRanges
For Each oField In oStory.Fields
oField.Update
Next oField
Next oStory
On Error GoTo 0
End Sub

1. Select tools/macro/macros type the macroname into the macroname window at the top of the wizard i.e. the bit after Sub and before () here UpdateAll - (no spaces in the name!)

2. In the panel directly beneath the large macro names window, pick which template or document you wish the macro to be saved in. If you select All active templates and documents the macro will be saved in normal.dot. This may or may not be what you want. If it isn't, change it so that it reads the template where you want to store your macro.

3. Click 'create'.

4. The macro editor will open at the correct place.

bulletThere will be an entry as follows:
Sub macroname()
' macroname Macro
' Macro created date by user
End Sub
          

5. Copy the complete block of code from the newsgroup post to the clipboard.

6. Switch to the macro editor window. 

Select all the above listed block and paste the contents of the clipboard over it.

Some listings do not include the Sub ... End Sub lines. In this case, give the macro a useful descriptive name at (1) above and paste the code between the Sub and End Sub lines.

If there is code in your window in red, it probably means that your newsreader wrapped a line of code that was meant to be one line. Try deleting at the end of the line and "unwrap" the line of code. If in doubt, ask.

7. Click the 'save' icon and close the editor.

8. From Word's document screen, right click on the toolbar and select 'customize' then from the command list (left window) select macros.

9. In the macro list (right window) pick your newly created macro with the left mouse button and drag it to your toolbar and drop it where you would like it to appear. (Or drop it in an appropriate menu if you prefer). Right click on either entry and edit the name to something sensible - for a toolbar button use an abbreviation or suitable icon. You can change the display to "default" from "text only" as well.

10. Close the 'customize' wizard and the macro will be available to your documents. If you saved it in normal.dot or another global template, it will be available to all of your documents. If you saved it in a template, it will be available in all documents based on that template (so long as the template is still "attached." See Template Basics for more on the various kinds of templates and how to use them.

<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
-- Graham Mayor (http://www.gmayor.com/Word_pages.htm)
The five ages of man:
Lager.. Aga .. Viagra .. Saga .. Gaga
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>

(With suggestions from Ibby and editing by CK.)

Graham has put this on his own web page which is probably more up-to-date.

If this isn't making sense, you may want to read  it put another way on the MVP website in the article by Dave Rado.

If you are careful, you can use your own macros to intercept and replace standard word commands (that are triggered by buttons already on a built-in toolbar). See Intercepting Events like Save and Print by Dave Rado, Anna-Karin Bohman and Jonathan West.

For more on macros follow the links at VBA Web Resources and see: The Microsoft Word MVP FAQ on VBA

 

Return to Questions List

 The up-to-date version of this FAQ may be found at:

http://www.addbalance.com/word/

Download this FAQ in Word 97 format

Send e-mail

Changes / suggestions / ideas can be sent to Charles Kenyon

Hit Counter views since 13 April 2004

Many people visit this site and use the information it contains.
It costs money to keep on line and effort to update.
If you have received assistance here
please consider making a donation if you can.

 
Thank you. ckk

Copyright 2000-2017 Charles Kyle Kenyon

FAQ provided as an adjunct / hobby as a part of my web site as a criminal defense lawyer.

Smile! Bumper stickers and jokes.

Using Date Fields in Microsoft Word
Calculated Dates
Booklet Formatting and Printing in Microsoft Word
Changing the Default Font in Microsoft Word
Document linked to Printer in Microsoft Word
Fonts Missing from Menu in Microsoft Word
How can I get a different header / footer on the second page?
Heading? Header? Microsoft Word Help
More on Headers and Footers in Word
Letterhead
Mapped Content Controls and Document Properties
Weird Lines and Borders
Macros and VBA
Master Documents Feature in Microsoft Word
A Back CoverPage in Microsoft Word
Normal Template in Microsoft Word - How to Open or Find the Normal Template
My docs open in the wrong program! Re-registering Word using the commandline.
Moving (Sharing) Customizations in Microsoft Word
Global StyleSheet?
MVP means?
Naming Files - A System is the Key
Posting tips in the Microsoft Word Forums
Getting rid of that (*)#"@^ paperclip! - Taming the Office Assistant
Page X of Y doesn't work in Microsoft Word!
Save Changes to the Global Template? Keeps Popping Up
Templates in Microsoft Word
Global Templates
Too Many Icons on the Taskbar in Microsoft Word 2000
Getting Rid of the Web Toolbar in Microsoft Word
Word for Word Perfect Users
Favorite Documents Menu
Work Menu in Microsoft Word
Templates Menu in Microsoft Word
What books have been recommended about Microsoft Word?
Where can I find more templates?
Word Links

Click to return to table of contents page of Intermediate User's Guide to Microsoft Word.Click to go to Microsoft Word new users frequently asked questions site in a new browser window.
(Intermediate Users' Guide) - - - - - - - - - - - - - - - - - - -  (Questions List)

Home
Word Tutorial - Intermediate
Legal Users Guide to Word
Downloads
Books about Microsoft Word - Newsgroup suggestions
Links
Web Resources for Microsoft Word