Fonts viewer software

 

 

Editing Macros: Fear Not

PC Magazine , November, 2002

You`ve used Microsoft Word`s Macro Recorder to create a great macro, but it doesn`t quite work the way you intended. Or perhaps you need to extend the capabilities of a favorite macro. You may think that the solution is to record the macro anew. But there`s a better way”the Visual Basic Editor that ships with Word. This is a great way to create or edit macros, but many people assume that they lack the requisite knowledge and that horrible things can happen (like Word refusing to run) if you incorrectly edit a macro`s programming code.

In this article we`ll explain how to use the VB Editor safely to edit a macro, without any programming knowledge. We`ll ease into this brave new world by using Word`s Macro Recorder to create two simple macros, which we will then edit in the VB Editor.

Safety First

Word macros are stored in templates. You probably store yours in Normal.dot, the default template Word uses for all documents. A corrupted template can cause Word to misbehave”or stop functioning entirely”so it`s a good idea to make a backup copy of your template before you do any substantial macro editing.

To save templates safely, first close Word if it is open and then use File | Save As to create a copy of Normal.dot with another filename. We copied Normal.dot to Normal.001 the first time we edited it, then Normal.002, and so forth. Using the date in the filename can also be useful. Such naming strategies provide a trail of fallback versions if they are needed.

Creating the Basic Macros

Let`s say you have a set of documents you want to use for a client presentation, but you want to make them uniform. It is extremely tedious to go into each document and change the various elements, but macros can turn this into a quick and easy project. You start by recording a macro to change the fonts. Create a test document to work with, then start the Macro Recorder with Tools | Macro | Record New Macro and name the macro Client1. Now select the entire document with Edit | Select All and convert all text to the Arial typeface by selecting Arial from the drop-down Font list on the Formatting toolbar. If you`re using Word 2002, you may think you`re finished, but there is one more step: Select Arial from the nearby drop-down Style menu.

Next, record another macro named Copyright, which inserts a Word page footer containing a copyright notice into your documents. Begin recording, select View | Header and Footer, and click on the Switch Between Header and Footer button in the toolbar that appears. Type some text for your footer and click the Close button.

Inside the Macros

We now have two macros, Client1() and Copyright(). Let`s take a look at them in the VB Editor. Select Tools | Macro | Macros, and in the dialog box that appears, select the Client1 macro name and click the Edit button. The document that appears actually contains all of the macros you`ve created.

Macros are in fact Visual Basic subroutines. A macro begins with a line containing the word Sub, the macro`s name, and parentheses, as in Sub Client1(); it ends with the statement End Sub. Everything in between is the code that does the nitty-gritty work of the macro.

Take a look at Figures 1 and 2, which show the Word 2000 and Word 2002 versions of Client1(), respectively. Both versions include unnecessary code that we can delete. In the Word 2000 version, it`s easy to figure out what you can delete: A bug causes the Macro Recorder to insert the following line twice.

Selection Font.Name = "Arial"

You need only one such line, so delete the other. As always, be careful when deleting or adding lines, making sure that each line of the resulting code remains on its own line. When satisfied, select Save | Normal in the VB Editor, return to the Word window, and check your macro on a test document.

The Word 2002 version of Client1() contains a lot more code, because Word recorded all elements of the states you changed when you selected from the Font and Style pick lists, so you need to do a bit more sleuthing to determine what you can delete. We want to keep the Selection.WholeStory, which selects the entire document. But the lines between the first With Selection.Font and its corresponding End With have nothing to do with changing to the Arial font and thus can be deleted. The only line related to our goal occurs in the second With Selection.Font section: .NameAscii = "Arial". You can delete all the other lines in that section. The result should look like this:

Sub Client1() ` ` Client1 Macro ` Macro recorded 08/21/02 by J. W. Olsen ` Selection.WholeStory With Selection.Font .NameAscii = "Arial" End With End Sub

How do you know what you can edit safely? To a large extent, this comes with experience and experimentation. But as in examples here, duplicate code may be wasted code, cluttering and slowing down a macro. Entire chunks of code, in fact (such as the With End With block in the Word 2002 macro), may show no apparent connection to the desired goal of a macro and thus are candidates to test for deletion. You can comment a line out first to see what happens. And as long as you`ve saved backup versions, you can feel free to experiment.

Robert`s Runes Font 2.0

Robert`s RUNES Fonts are a complete 26 character runic alphabet. There are over 10 different style rune alphabets. Robert`s RUNES are based on the Futhark and the Elder Futhark runes. The runes are an ancient alphabet that has been used for magic and other purposes throughout the ages. Now you can write your own rune scrolls, parchments, poster lettering, websiteheadings, etc.

Visit homepage of Robert`s Runes Font

Project index