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 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
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 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. |