ADMINISTERING MACROSMove a Macro from One Template to AnotherThe Annoyance:I reckon I've more or less gotten the hang of the Visual Basic Editor by nowat least, I can create and edit macros in different projects. But do you mean to tell me that I need to use Cut and Paste to move a macro from one project to another? The Fix:You've hit upon one of the Visual Basic Editor's most dramatic shortcomings: the inability to copy or move a macro quickly from one project (a template or document) to another. But Word itself can take care of this task: choose Tools Macro Macros, click the Organizer button in the Macros dialog box, and then click the Macro Project Items tab. See which projects are open in the two "Macro Project Items available in boxes; if necessary, click the Close File button to close one of the open projects, and then use the resulting Open File button to open the relevant project. With the projects open , select the item you want to copy, and click the Copy button. To move an item, copy it to the new location and then click the Delete button to delete it from the source project. When you've finished copying or moving items, click the Close button to close the Organizer dialog box, and save the documents or templates with which you've been working. Find Out Why Word Won't Run a MacroThe Annoyance:When I open the template that one of my colleagues has developed, Word says that the macros are disabled and tells me to check the host application's online help or documentation. Help! What's a host application, what's the problem, andmost of allhow do I fix it? The Fix:Visual Basic for Applications is what's called a hosted programming language: instead of running on its own, as Visual Basic itself does, VBA requires a host application to provide it with an environment in which to work. Word is the host application here; the other Office applications, and many other applications, also host VBA. The problem is that Word's security settings are set to protect you from potentially dangerous code. Because VBA can take a wide variety of actions on your computer without your intervention, it's a security threat. Consequently, Microsoft has bundled up Word (and the other Office applications) increasingly tightly against malefaction. When you open a VBA project that might be dangerous, Word disables its macros (see Figure 8-5). Figure 8-5. If Word automatically disables macros that you need to run, you may need to change your security settings.To change the security settings so that you can run the macros ( assuming that you trust the template's creator not to use them to wreak havoc on your machine), choose Tools Macro Security and select the appropriate option on the Security Level tab (see Figure 8-6). Word 2003 offers Very High, High, Medium, and Low levels; Word XP and Word 2000 do not offer the Very High level. Heres what you need to know about the details:
Figure 8-6. The Security Level tab lets you control whether Word will run macros that are not signed with digital signatures or installed in trusted locations.
Tip: If you distribute your macros to other people, you will need to sign them to ensure that they are trusted. Once you've installed a digital certificate on your PC, you can sign a macro project (for example, a template) in the Visual Basic Editor: click the project in the Project Explorer, choose Tools Digital Signature, click the Choose button, pick the certificate in the Select Certificate dialog box, and click the OK button to close each dialog box. Macro Macros, and click the Organizer button. Use the controls on the Organizer dialog boxs four tabs to move the AutoText entries, keyboard shortcuts, and custom toolbars and menus to the new template. Save the template and close it. Still in Word, choose Tools Templates and Add-Ins, click the Add button, navigate to and select the template, and then click the OK button to load it as a global template. Back up this global template frequently as well, in case it too sustains corruption. Tip: You can load the global template automatically, if you prefer, by placing it in your Word Startup folder. Choose Start Run, type %userprofile%\Application Data\Microsoft\Word\Startup , and press Enter to open a Windows Explorer window to your Word Startup folder. |