Installing and Enabling VBA

Unfortunately, there are enough unscrupulous programmers out in the world that security is of paramount importance for your computer. Computer viruses are common and, like technology in general, are becoming increasingly more complex. Macro language viruses such as those written in VBA are relatively easy to write—even for a beginning programmer. As a result, Microsoft has added several levels of security to its Office programs in order to protect against macro viruses. The first level of security Microsoft has implemented is simply to disable macro language support for its Office programs. Disabling macro language support is now the standard for the normal installation of Office or any of its component programs.

If items such as add-ins, wizards, and the VBA project files on this book's accompanying CD do not function, then your Excel program was either installed without VBA or with VBA disabled. You must install VBA and enable macro language support before you can access the VBA IDE and create your own projects or use any of the aforementioned tools.

To install or enable VBA, you must insert the CD that contains the Excel program into your computer and run the Office/Excel setup program by doing the following:

1. Double-click the Add/Remove Programs icon in the Microsoft Windows Control Panel (found on the Start menu).

2. If you installed Excel as part of Microsoft Office, click Microsoft Office (edition and version) in the currently installed programs box, and then click the Change button. If you installed Excel individually, click Excel (edition and version) in the currently installed programs box, and then click the Change button.

3. On the features to install screen in the Setup program, click the plus sign (+) next to Office Shared Features.

4. Select Visual Basic for Applications, click the arrow next to your selection, and then click Run from My Computer.

5. In addition, you should install the VBA help files by selecting Visual Basic Help and Run from My Computer.

After the installation is complete, you may also need to change the macro security setting in Excel before you can run any VBA programs. To change the macro security setting in Excel, do the following:

1. Select Tools, Macro, Security from the Excel application window (see Figure 1.2).

2. Set the security level to Medium or Low to enable macros.

Security Level Trusted Publishers

O Very High. Only macros installed in trusted locations will be allowed to run. All other signed and unsigned macros are disabled.

Security Level Trusted Publishers

O Very High. Only macros installed in trusted locations will be allowed to run. All other signed and unsigned macros are disabled.

High. Only signed macros from trusted sources will be allowed to run. Unsigned macros are automatically disabled

Medium. You can choose whether or not to run potentially unsafe macros.

O Low (not recommended). You are not protected from potentially unsafe macros. Use this setting only if you have virus scanning software installed, or you have checked the safety of all documents you open.

I recommend setting the macro security level to Medium so that you will be able to run (and therefore test) your VBA programs, yet still receive a warning message that macros are present in the file. With the macro security level set to Medium, you will always know if a macro is present in an Excel file, and then you can decide if it's safe. Never enable macros attached to an Excel file from an untrustworthy source! Note that setting the security level to High will disable any macro attached to an Excel file that has not been digitally signed.

To ensure that third-party software written for Excel 2003 is from a trustworthy source, Microsoft allows programmers to digitally sign a file or a VBA project by using a digital signature. A digital signature is an electronic authentication mechanism for a program or document. A digital signature confirms that the program originated from the signer and has not been altered. To digitally sign macro projects, you must install a digital certificate. A digital certificate attached to a program vouches for its authenticity. Digital certificates are obtained from commercial vendors such as Verisign who act as a trusted third party in the transaction. When you set the macro security level to High, you can run macros written by programmers if they are digitally signed and have been added to your list of trusted sources.

Macro security level settings in Excel.

OK I I Cancel

In the Real World

Biorhythm Awareness

Biorhythm Awareness

Who else wants to take advantage of biorhythm awareness to avoid premature death, escape life threatening diseases, eliminate most of your life altering mistakes and banish catastrophic events from your life.

Get My Free Ebook


Post a comment