Using "Found" Macros

Over the past few weeks we’ve been talking about recording macros to automate repetitive tasks in Microsoft Word. You can read the newsletters here:

http://www.topica.com/lists/editorium/read/message.html?mid=1706651129

http://www.topica.com/lists/editorium/read/message.html?mid=1706748016

http://www.topica.com/lists/editorium/read/message.html?mid=1706832239

What you may not know is that there are lots of “prerecorded” macros that will do all kinds of neat things. For example, subscribers to the Word-PC email list often post useful macros. You can learn more about the list (and search the list archives) here:

http://listserv.liv.ac.uk/archives/word-pc.html

You can also find macros on the Web by searching for the keywords “microsoft word macro” in your favorite search engine.

The macros you find will probably look something like this:


Sub CopyToSpike
If WordBasic.GetSelStartPos() <> _
WordBasic.GetSelEndPos() Then 'Text is selected
WordBasic.Spike 'Add entry to spike
WordBasic.EditUndo 'Undo the cut
Else
WordBasic.MsgBox "Please select text before running this macro.", _
"No Text Selected"
End If
End Sub

That particular macro copies text to the Spike. You can learn more about it here:

http://www.topica.com/lists/editorium/read/message.html?mid=1701697740

However, you don’t have to understand how the macro works in order to use it. Here’s how to put it (or any other macro) into Microsoft Word so it will be available when you need it:

1. Copy the text of the macro, starting with the first “Sub” and ending with the last “Sub.” If the macro doesn’t have those “Sub” lines at the beginning and end, skip step 8 in these instructions.

2. Click the “Tools” menu at the top of your Microsoft Word window.

3. Click “Macro.”

4. In Word 97 or later, click “Macros.”

5. Make sure “Macros Available In” shows “Normal.dot.”

6. Type a name for the macro in the “Macro Name” box–probably the name used after the first “Sub.” For this macro, that’s “CopyToSpike.”

7. Click “Create.”

8. Delete the “Sub [macro name]” and “End Sub” lines that Word created in the macro window. The macro window should now be completely empty.

9. Paste the macro text at the current insertion point.

10. In Word 6 or 7, click “File,” then “Close,” then “Yes.” In Word 97 or later, click “File,” then “Close and Return to Microsoft Word.”

The macro is now stored in your Normal template, ready for use.

To actually run the macro, do this:

1. Click the “Tools” menu.

2. Click “Macro.”

3. In Word 97 or later, click “Macros.”

4. Click the name of your macro to select it.

5. Click the “Run” button. (If you wanted to delete the macro, you could press the “Delete” button instead.)

And now, some cautions:

1. Make sure the macro was created for the version of Word you are using. Macros created for Word 97 and later versions will not run in earlier versions, and you can’t just paste macros written for earlier versions into Word 97 and later. Also, later versions of Word have certain features that earlier versions don’t, so a macro that uses features specific to Word 2000 won’t run in Word 97.

2. Try to make sure the macro comes from a reasonably reliable source.

3. Before using a macro on a real document, test it on a backup copy of the document to *make sure* it does what you need it to do.

_________________________________________

READERS WRITE

Subscriber Meg Cox wrote:

Newly committed to automating whatever I can, I tried to automate changing a word or phrase in quotes to italics and removing the quotes. But with wildcards turned on, Find wouldn’t find quotation marks at all. Any idea of where I might be going wrong?

I responded (in summary):

If your document has curly quotes, use ^0147 (for opening) and ^0148 (for closing). Those are the ANSI codes for curly quotation marks. If your document has straight quotes, use ” in your find and replace.

As I tested this, I used this string in the Find What box:

“(*)”

And this string in the Replace With box (formatted as italic):

1

Or, if you have curly quotes, you could find this:

^0147(*)^0148

And replace with the same thing (formatted as italic):

1

This will cause you trouble if you have unmatched quotation marks. If that’s the case, you might need to do something like this:

“([!”]@)”

Or this:

^0147([!^0147]@)^0148

This entry was posted in Macros. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

You must be logged in to post a comment.

  • The Fine Print

    Thanks for reading Editorium Update (ISSN 1534-1283), published by:

    The EDITORIUM, LLC
    http://www.editorium.com

    Articles © on date of publication by the Editorium. All rights reserved. Editorium Update and Editorium are trademarks of the Editorium.

    You may forward copies of Editorium Update to others (but not charge for it) and print or store it for your personal use. Any other broadcast, publication, retransmission, copying, or storage, without written permission from the Editorium, is strictly prohibited. If you’re interested in reprinting one of our articles, please send an email message to editor@editorium.com

    Editorium Update is provided for informational purposes only and without a warranty of any kind, either express or implied, including but not limited to implied warranties of merchantability, fitness for a particular purpose, and freedom from infringement. The user (you) assumes the entire risk as to the accuracy and use of this document.

    The Editorium is not affiliated with Microsoft Corporation or any other entity.

    We do not sell, rent, or give our subscriber list to anyone.