Macro Security

 < Day Day Up > 



Macro Security

Macros and VBA are one of the most misunderstood features of Word. The macro virus warning pop-up can still shock a seasoned user into cardiac arrest! The plain truth is that once you read this, you will no longer fear the warning; in fact, you should welcome it.

start sidebar
Tip 50: Avoiding Viruses

To avoid getting any type of virus into your system or company network:

  • Never open emails from people that you don’t know.

  • Especially, never open email attachments from people you don’t know.

  • If in doubt, throw it out.

  • If you open a Word document and receive the warning, ask the person who created it why you might be getting that warning before you enable macros.

  • If you open a Word document that you created and no one has had access to it, immediately disable macros.

end sidebar

Although many companies set restrictions on your ability to run macros, most do not. Most companies leave this decision up to the user—as well they should. Keeping users from learning about macros (and macro security, of course) might as well be saying, “Now, now. We don’t want you to become TOO efficient!”

So, if you are a decision maker about such things, we encourage you to distribute information about macros, macro security and encourage your users to use macros!

start sidebar
Tip 51: Setting Macro Security

For most users, being asked to enable macros when you open a document that contains macros is the best option. This always provides you with a choice.

To enable macros:

Version Commands

Word 97

Word 2000

Word 2002/XP

You can access the setting the same as you can in 2000, however, there is an additional setting to consider. Click on the Trusted Sources tab and check the box shown below.

This additional setting provides even stricter macro security. Checking it enables you to use the code in any add-ins or templates that you use.

For all of the macro security settings, use them at your own risk. There is absolutely no system completely invulnerable to viruses, however, and it is often fairly simple to clean a system of them.

I need to tell this story: Macro viruses were, for several years, nothing more than a nuisance. As insane as it sounds, there was a Word macro virus out there that I just loved. It would grab your user name from your PC and put some text behind it. Here’s a message similar to what you’d get when you closed the file:


Figure 21-1: Macro Virus Message

While providing over-the-phone software support, there was nothing funnier than having some guy call and try to explain this problem. I remember one in particular. I could just tell this was an older gentleman and probably in an important position because he had his assistant put the call through. It was very tough not to giggle. Thank goodness, it’s very easy to get rid of!

This macro “virus” is so ridiculously easy to create. Though I only suggest doing it to someone who can take a joke. See the section on page 21-15 to see how it’s done.

end sidebar

start sidebar
Tip 52: Getting Rid of a Macro Virus

This method only gets rid of the simplest of macro viruses in Word. While we may call them viruses, they’re generally just a piece of VB code that runs when you open, close, save or take some other action in your document(s).

On opening the infected file, the code tells your PC to copy the infecting code into your normal.dot file, thus it affects all files on your system, BUT IT DOES NOT INFECT THE FILES. This is a common belief that just isn’t true.

You’ll likely be able to pinpoint the infected file and clean it up yourself with the instructions in Clean Documents of Code, below. To clean your normal.dot, refer to Step 3 of Troubleshooting Word on page 24-9.

end sidebar

Clean Documents of Code

Yes, you can easily erase code from a document. I provide a sample macro that can clean all code out of a document on page 21-17. However, I thought we should introduce you to the Visual Basic Editor.

First ensure that the document should not contain any code and then follow these steps:

  1. Open the VB Editor window (commonly referred to as the VBE) by using Alt+F11.

    You’ll see the Project Explorer, as shown in Figure 21-2, in the upper, left-hand side of the window. If you don’t see it, hit Ctrl+R.


    Figure 21-2: VBE Project Explorer

  2. Double-click the ThisDocument object. On the right-hand side of the window, you’ll see the Code window, as shown in Figure 21-3.

    click to expand
    Figure 21-3: The Visual Basic Editor (VBE)

  3. If you see any code in the Code window, click inside the code window, hit Ctrl+A to select all and hit your delete key.

There may or may not be code in ThisDocument or in any Module(s). The existence of a module, whether it contains code or not, fires the macro virus warning message on opening of the document if your Macro security is set to warn you.

If your Project Explorer looks like the one in Figure 21-4, you may then need to double-click the Module and do the same to delete the code from the code window as you did in Step 3, above.


Figure 21-4: VBE Project Explorer with Modules

If any modules are empty, or if you have deleted the code from them, you can right-click each one and choose to Remove it. When asked if you’d like to export it before removing it, you likely want to choose not to do so.

However, if you have a piece of VB code in a Word file and you want to use it in another file, you can export a module and import it into another document.

Not all modules are named “Module.” You may find that someone has renamed it to, for instance, “MrgModule,” if they intended to place the code in the file for mail merge use. The name of modules is entirely up to the person who programs it.



 < Day Day Up > 



Dreamboat on Word
Dreamboat on Word: Word 2000, Word 2002, Word 2003 (On Office series)
ISBN: 0972425845
EAN: 2147483647
Year: 2003
Pages: 130
Authors: Anne Troy

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net