Page 63 - Microsoft Office Excel 2003 Programming Inside Out
P. 63

Exploring Visual Basic for Applications

























                             The next-higher security level is Medium, which means Excel will display a dialog box asking
                             if you want to enable macros whenever you try to open a workbook that contains macros.   Chapter 3
                             Clicking Enable Macros will open the workbook and allow you to run the macros in the
                             workbook, clicking Disable Macros will open the workbook but prevent the macros from
                             being run, and clicking Cancel will prevent the workbook from being opened. If you work
                             with a lot of macros, are the only person who uses your computer, and you are confident you
                             will remember not to click Enable Macros if an unexpected file, or a file you didn’t expect to
                             contain macros, appears in your e-mail In box or a shared folder, you can use the Medium
                             setting. If you share your computer with other users, or if you go away on vacation and want
                             to be a bit cautious about what can and can’t be done on your computer, you should strongly
                             consider changing the macro security level to High. You can always switch back to Medium
                             when you return.

                             Introducing Digital Signatures

                             The mechanics of the High security setting relies in part on the use of digital signatures to ver €
                             ify the source of the VBA code in a workbook. A digital signature is the result of an operation
                             using the principles of public-key encryption techniques to create a unique combination of
                             the signed material and a file that is known only to you, but the result of which can be verified
                             as having been signed by you. The mathematics are quite complex, relying on group theory
                             and other disciplines only a handful of researchers really understand, but here’s a synopsis of
                             how it works.

                             The first step is for you to generate a key that will be used to encrypt your data by adding the
                             values in the key to the values in the text. A simple example would be if your key were a and
                             the word to be encrypted were kazoo. If you “add” a, the first letter in the alphabet, to each
                             letter in kazoo, you will increment the letter by one place, resulting in the encrypted word





                                                                                                        37
                                                                                        Part 2:  Visual Basic for Applications
   58   59   60   61   62   63   64   65   66   67   68