0% found this document useful (0 votes)
27 views44 pages

03 Introduction To Excel Macro Security and Storage - J.A. Gomez

Visual Basic

Uploaded by

uday_kendhe9005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views44 pages

03 Introduction To Excel Macro Security and Storage - J.A. Gomez

Visual Basic

Uploaded by

uday_kendhe9005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 44

Introduction to Excel Macro Security and Storage

Introduction to Excel Macro Security and


Storage
The Beginners Guide to Managing the Main Excel Macro
and VBA Security Features and Storage Options to Reduce
Risks While Increasing Your Power and Efficiency
by J.A. Gomez

Copyright © 2018 by Jorge Alberto Gomez Soto.

All rights reserved.

This publication is licensed for your personal enjoyment only. If you would like to
share this publication with another person, please purchase an additional copy for
each recipient. If you are reading this publication and did not purchase it, or it was
not purchased for your use only, then please return to Amazon.com and purchase
your own copy. Thank you for respecting the hard work of the Publisher and Author.

No part of this publication may be reproduced, stored in a retrieval system,


transmitted, translated, reprinted, reused, recited, broadcasted, sold or similar, in
whole or in part, in any form or by any means, electronic, mechanical, including
without limitation photocopying, microfilms, scanning, electronic adaptation,
recording, computer software, by any information or storage retrieval system, or
otherwise by any similar or dissimilar methodology now known or hereafter
developed without the prior written consent from the Publisher.

Trademarked names, logos and images may appear in this publication. Rather than
use a trademark symbol with every occurrence of a trademarked name, logo or
image, the names, logos and images are used only in an editorial fashion to the
benefit of the trademark owner, with no intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar
terms, even if they are not identified as such, is not to be taken as an expression
of opinion as to whether or not they are subject to proprietary rights. Additionally,
use of a term in this publication should not be regarded as affecting the validity of
any trademark.

2
Introduction to Excel Macro Security and Storage

Excel is a registered trademark of Microsoft Corporation. All other trademarks and


registered trademarks appearing in this publication are the property of their
respective owners.

The Publisher and the Author make no representations or warranties with respect
to the accuracy or completeness of the contents of this publication and specifically
disclaim all warranties, including without limitation warranties of fitness for a
particular purpose. No warranty may be created or extended by sales or
promotional materials.

The information provided in this publication is for information purposes only and is
provided on an "as is" basis. The advice and strategies contained herein may not
be suitable for every situation. Users of this publication are advised to carry out
their own due diligence when it comes to making decisions related to the contents
of this publication.

This publication is sold with the understanding that the Publisher and the Author
are not engaged in rendering legal, accounting, technical or other professional
services. If professional assistance is required, the services of a qualified
professional should be sought. All information, products and services that are
mentioned or provided in this publication should be independently verified by your
own qualified professionals.

The fact that an organization or website is referred to in this publication as a citation


or a potential source of further information does not mean that the Author or the
Publisher endorse the information the organization or website may provide or
recommendations it may make. Further, readers should be aware that internet
websites listed in this publication may have changed or disappeared between the
moment when this publication was initially published and the moment when this
publication is read.

Neither the Author, the Editors nor the Publisher shall be liable nor responsible for
any errors or omissions that may be made in this publication, nor for any damages
arising (directly or indirectly) from this publication.

By using this publication, you agree that the Author, the Publisher and any related
persons or parties are not responsible for the success or failure of any decisions or
actions related to any information presented in this publication. The Author and
Publisher shall have neither liability nor responsibility to any person or entity with
respect to any loss or damages arising (directly or indirectly) from the information
contained in this publication.

3
Introduction to Excel Macro Security and Storage

Author: J.A. Gomez.

Layout: Walter Gray.

Copy Editor: Martin Phillips.

Proofreader: Kevin Thomas.

Cover Designer: Anthony Baker.

Published by: Power Spreadsheets.

First Edition: December 2018.

4
Introduction to Excel Macro Security and Storage

Table of Contents
Introduction ................................................................................................ 9

About this Book ........................................................................................ 9

About J.A. Gomez...................................................................................... 9

How this Book is Organized ...................................................................... 11

More Information .................................................................................... 11

Chapter 1: Introduction to Macro Security .................................................... 12

Introduction ........................................................................................... 12

The Power of Macros and VBA ................................................................... 13

The Excel and Windows Security Models ..................................................... 14

Unintentional Misuse of Macros and VBA .................................................... 15

Summary and Key Concepts ..................................................................... 15

Chapter 2: Enable or Disable Macros ............................................................ 17

Introduction ........................................................................................... 17

Specify General Macro Security Settings .................................................... 17

The Four Global Macro Security Settings .................................................... 18

Disable All Macros With Notification ......................................................... 19

Summary and Key Concepts ..................................................................... 22

Chapter 3: Trusted Locations and Trusted Publishers ..................................... 24

Introduction ........................................................................................... 24

Trusted Locations .................................................................................... 24

Specify a Trusted Location........................................................................ 25

How to Choose Folders to Designate as Trusted Locations ............................ 27

Introduction to Trusted Publishers ............................................................. 29

Summary and Key Concepts ..................................................................... 29

Chapter 4: Excel File Types ......................................................................... 30

5
Introduction to Excel Macro Security and Storage

Introduction to Excel File Types ................................................................ 30

Excel File Types ...................................................................................... 30

Distinguishing File Types is Important ........................................................ 31

Save Excel Workbooks Containing Macros .................................................. 32

Change the Default File Type of Excel Workbooks ........................................ 34

Summary and Key Concepts ..................................................................... 36

Chapter 5: The Personal Macro Workbook ..................................................... 37

Introduction to the Personal Macro Workbook ............................................. 37

When to Use the Personal Macro Workbook ................................................ 37

How to Create Your Personal Macro Workbook ............................................ 38

Unhide the Personal Macro Workbook ........................................................ 39

Save Changes to the Personal Macro Workbook .......................................... 41

Summary and Key Concepts ..................................................................... 41

Next Steps................................................................................................ 42

I Want to Hear from You! ......................................................................... 43

6
Introduction to Excel Macro Security and Storage

Table of Figures
Figure 1: When describing Protected View, Microsoft refers to "reducing the risks".
............................................................................................................... 13

Figure 2: To enable/disable macros (step #1): Go to Developer → Macro Security.


............................................................................................................... 18

Figure 3: To enable/disable macros (steps #2 to #4): Specify Macro Settings →


click OK. ................................................................................................... 18

Figure 4: The four Global Macro Security Settings. ......................................... 19

Figure 5: The Microsoft Excel Security Notice dialog box. ................................ 20

Figure 6: Excel displays the security warning below the Ribbon. ...................... 20

Figure 7: Message box displayed by Excel when you attempt to execute a macro in
a workbook for which macros are disabled. ................................................... 21

Figure 8: To specify a Trusted Location (step #1): Go to Developer → Macro


Security. .................................................................................................. 25

Figure 9: To specify a Trusted Location (steps #2 to #4): Go to Trusted Locations


→ click Add new location. ........................................................................... 25

Figure 10: To specify a Trusted Location (steps #5 and #6): Click Browse........ 26

Figure 11: To specify a Trusted Location (steps #7 to #10): Select folder you want
to designate as Trusted Location → click OK. ................................................ 26

Figure 12: To specify a Trusted Location (steps #11 to #13): Select whether to
trust subfolders of location (optional) → enter description (optional) → click OK.27

Figure 13: To specify a Trusted Location (step #14): Click OK. ....................... 27

Figure 14: Allow Trusted Locations on my network (not recommended). .......... 28

Figure 15: Excel file types. ......................................................................... 31

Figure 16: To check a workbook's file extension (steps #1 to #3): Right-click →


select Properties. ....................................................................................... 32

Figure 17: To check a workbook's file extension (step #4): A workbook's file type
is displayed near the top of the General tab. ................................................. 32

7
Introduction to Excel Macro Security and Storage

Figure 18: To save a workbook containing macros (steps #1 and #2): Open the
Save As dialog box → specify file name. ....................................................... 33

Figure 19: To save a workbook containing macros (steps #3 and #4): Expand Save
as type drop-down list → select Excel Macro-Enabled Workbook. ..................... 33

Figure 20: To save a workbook containing macros (step #5): Click Save. ......... 34

Figure 21: To change the default file type (step #1): Go to File. ...................... 34

Figure 22: To change the default file type (step #2): Select Options. ............... 34

Figure 23: To change the default file type (steps #3 to #5): Go to Save → Select
file type using Save files in this format drop-down list. ................................... 35

Figure 24: To change the default file type (step #6): Click OK. ....................... 36

Figure 25: To create the Personal Macro Workbook (step #1): Click the Record
Macro button. ........................................................................................... 38

Figure 26: To create the Personal Macro Workbook (steps #2 to #4): Expand Store
macro in drop-down list → select Personal Macro Workbook → click OK. ........... 39

Figure 27: To create the Personal Macro Workbook (step #5): Click the Stop
Recording button. ...................................................................................... 39

Figure 28: To unhide the Personal Macro Workbook (step #1): Go to View →
Unhide. .................................................................................................... 40

Figure 29: To unhide the Personal Macro Workbook (steps #2 to #4): Select
PERSONAL → click OK. ............................................................................... 40

Figure 30: The Personal Macro Workbook. .................................................... 40

Figure 31: When closing Excel, save changes to the Personal Macro Workbook. 41

8
Introduction to Excel Macro Security and Storage

Introduction
About this Book
As implied by its title, the main purpose of this Book is to show you how to work
with the main Excel macro and VBA security features and storage options to:

• Reduce the risks that macros and VBA may generate; and

• Increase your power and efficiency when working with macros and VBA.

As you learn in this Book:

• You cannot fully eliminate the risks associated to working with Excel files, even
if you do not use macros or VBA.

• Both Microsoft Windows and Microsoft Office have several security features
that have an important influence in how you work with Excel macros and VBA.

• Macro and VBA security is, to a certain extent, related to storage. Therefore,
having a basic understanding of Excel's storage options helps you:

• Reduce the risks that macros and VBA may generate; and

• Increase your power and efficiency when working with macros and VBA.

One of the main goals of this Book is to help you gain the knowledge you need to
make an informed decision about the following:

• The appropriate macro and VBA security settings for your specific situation.

• How/where to store your macros and macro-containing Excel workbooks.

In other words, after reading this Book, you should be in a better position to work
with the main Excel macro and VBA security features and storage options in a way
that:

• You reduce (to the extent possible) the risks associated to working with Excel;
while

• Being able to harness the power of macros and VBA to increase your power
and efficiency.

About J.A. Gomez


This is a training and reference book on Excel macro and VBA security and storage.

9
Introduction to Excel Macro Security and Storage

The learning techniques and strategies I use in the following Chapters were first
applied to my own process of mastering macros and VBA.

I am originally from Colombia, a country in South America. However, I have been


very lucky and have had the opportunity to live, study and work in several
countries, including Spain, South Korea, Singapore, Germany and Canada.

Nowadays, I spend most of my time working on and researching about:

• Automation;

• Excel;

• Macros; and

• VBA.

However, this was not always the case.

In fact, my undergraduate degree is in Law. Even though I also studied Economics,


I only started my process of becoming an advanced Excel user when I decided to
stop working as a Lawyer and focus on Finance.

At times, I faced common self-limiting beliefs and doubts. These beliefs ranged
from believing that I was not very good at Math to thinking I would never be able
to learn how to program.

I was soon proved wrong. From the moment I decided to focus on Finance, data
analysis, automation and Excel, I have achieved a lot. This includes obtaining a
Masters in Quantitative Finance with Merit and offers for several good-paying jobs
(in a variety of countries and industries) where advanced knowledge of Excel was
a requirement.

These achievements, however, pale in comparison to the work I have done at my


website, PowerSpreadsheets.com. Power Spreadsheets has grown to become one
of the largest and most popular websites about Excel macros and VBA. I am grateful
that (every day) I get to help thousands of Excel users, just like you, become more
powerful and efficient.

The main reason I share my story is because I firmly believe that, if I could
overcome my limitations and self-limiting beliefs to master Excel macros and VBA,
you also can. I did not have any unique gifts, traits or experiences to indicate that
I would be able to become an authority in the field of Excel macros and VBA.

10
Introduction to Excel Macro Security and Storage

I decided to learn about these topics. I have invested a lot of time and money
towards achieving this goal. This experience of learning about Excel macros and
VBA has allowed me to organize and structure the information anybody, like you,
needs to learn about these topics.

How this Book is Organized


This Book is divided in five Chapters.

• Chapter 1 is an introduction to the topic of macro and VBA security.

• In Chapter 2, you learn how to specify Global Macro Security Settings. In other
words, you learn:

• How to specify whether macros are enabled or disabled by default; and

• The main consequences of each of the available Global Macro Security


Settings.

• In Chapter 3, you learn about two specific features (Trusted Locations and
Trusted Publishers) that allow you to further control and influence the way in
which your computer deals with Excel files containing macros.

• In Chapter 4, you learn about the different Excel file types. This includes
learning:

• Which Excel file types can (and which ones cannot) contain macros; and

• How to save Excel workbooks that contain macros.

• In Chapter 5, you learn about a special Excel workbook (known as the Personal
Macro Workbook) you can use to store commonly-used macros.

More Information
In addition to authoring this Book, J.A. Gomez is the creator of one of the most
successful Excel macro and VBA websites. You can learn more about J and obtain
free supplemental training materials at PowerSpreadsheets.com.

11
Introduction to Excel Macro Security and Storage

Chapter 1: Introduction to Macro Security


In this Chapter, you learn:

• Why and how macros and VBA can be intentionally or unintentionally misused
and cause damage.

• Why you cannot fully eliminate the risks associated to working with Excel files,
even if you do not use macros or VBA.

• How Microsoft Windows and Microsoft Office have several security features,
some of which are specifically targeted at macros and VBA.

• What the four main Excel macro and VBA security-related features are.

Introduction
Macros and VBA can be very powerful and useful. This power, when used for
positive purposes, enhances your working experience.

However, as you learn in this Chapter, the power of macros and VBA can potentially
be misused and cause damage.

Therefore, you want to take precautions to reduce the risk of being victim of, for
example, viruses distributed through macros. Having a basic understanding of the
applicable macro security settings can be very useful for these purposes. This
knowledge allows you to decide how to configure those settings for your own
purposes.

I refer to "reduce" instead of "eliminate" the risks associated to working with Excel
because no security system is perfect. Microsoft itself usually uses terms such as
"minimize" or "reduce". As shown in Figure 1 below, this is the case (for example)
when referring to Excel's Protected View.

12
Introduction to Excel Macro Security and Storage

Figure 1: When describing Protected View, Microsoft refers to "reducing the risks".

Because of these reasons, there is always some risk that a malicious file enters
your computer even if you follow all the best security practices. This risk, however,
is not unique to working with macros and VBA. In other words, malicious files can
enter your computer regardless of whether you work with macros and VBA or not.

Therefore, please remember to always take the precautions that are required in
the specific situation you are in, even if you are not dealing with macros and VBA.

The Power of Macros and VBA


As I explain in Introduction to Excel Macros & VBA, a macro is (at a basic level) a
small computer program.

Since they are computer programs, macros can do things such as:

• Accessing your computer's hard drive; or

• Controlling other Programs or Applications, including the Windows Application


itself.

Because of these abilities, macros can be used for malicious purposes, including
the following:

• Erasing system files;

• Installing malicious files (for example, virus or malware);

• Sharing (important or confidential) information stored in your computer; or

• Generally manipulating your computer, data or files.

In addition to the above, certain macros are executed automatically. Some of them
run immediately after you open the Excel workbook that contains them. Because
of this, you do not even need to take a positive action for certain macros to execute.

13
Introduction to Excel Macro Security and Storage

These risks are not hypothetical. Macros have been used as a tool for spreading
viruses.

The Excel and Windows Security Models


Microsoft is aware of the risks that arise out of the (intentional or unintentional)
misuse of macros and VBA.

Therefore, throughout the last few Excel versions, Microsoft has made several
changes to the Excel security model.

Both Microsoft Windows and Microsoft Office have several security features. Their
purpose is to protect:

• You;

• Your computer; and

• Your data.

Some of these security features are specifically targeted at macros and VBA. These
features are the focus of this Book.

In other words, this Book does not cover any of the following:

• General security advice, such as:

• Installing a good antivirus;

• Regularly backing up your files; or

• Being careful when opening email attachments or other files that may
contain malicious code.

• General Windows or Office security features.

The following are the four main Excel macro and VBA security-related features you
learn about in this Book:

#1. Enabling or disabling macros by default.

#2. Trusted Locations.

#3. Trusted Publishers.

#4. Excel file types.

14
Introduction to Excel Macro Security and Storage

Several of these topics are closely related to macro storage. Therefore, you also
learn about a special Excel workbook (known as the Personal Macro Workbook) you
can use to store commonly-used macros.

Unintentional Misuse of Macros and VBA


In previous Sections, you learned that macros and VBA can be intentionally misused
for malicious purposes. This is one of the main reasons why learning about Excel's
macro and VBA security settings is important and useful.

Nonetheless, macros and VBA can also cause damage when unintentionally
misused. Consider, for example, what may happen when you execute a macro in a
context that is not appropriate. This may result in, among others, the accidental
deletion or overwriting of your data.

Probably the best way to handle the risks arising out of the unintentional misuse of
macros and VBA is by:

• Having a good understanding of macros and VBA; and

• Ensuring you correctly understand what a macro does before executing it.

Summary and Key Concepts


• Macros and VBA can be potentially misused and cause damage. Therefore, you
want to take precautions to reduce the risks that macros and VBA generate.

• There is always the risk that a malicious file enters your computer even if you
follow all the best security practices. This risk exists regardless of whether you
work with macros and VBA or not.

• Macros can:

• Be used for malicious purposes; and

• In some cases, be executed automatically.

• Both Microsoft Windows and Microsoft Office have several security features.
Some of these features are specifically targeted at macros and VBA.

• Macros and VBA can cause damage when unintentionally misused. Probably
the best way to reduce the risks arising out of this is by:

• Having a good understanding of macros and VBA; and

15
Introduction to Excel Macro Security and Storage

• Ensuring you correctly understand what a macro does before executing it.

16
Introduction to Excel Macro Security and Storage

Chapter 2: Enable or Disable Macros


In this Chapter, you learn:

• How to enable or disable macros by default by specifying Global Macro Security


Settings.

• What the four Global Macro Security Settings are.

• Which Global Macro Security setting is the default and most-commonly


recommended setting.

• Which Global Macro Security setting is usually not recommended.

• How Global Macro Security Settings can be overrun by more specific settings
or features.

• What Trusted Documents are.

• How an Excel workbook may become a Trusted Document, and the


consequences this has.

Introduction
The ability to enable or disable macros by default is one of the main ways in which
you control macro security.

Excel has four Global Macro Security Settings. These are one of the pillars of macro
security in general.

By understanding how each of these settings works in practice, you are in a better
position to make an informed choice among the following four Global Macro
Security Settings:

#1. Disable all Macros without notification.

#2. Disable all Macros with notification.

#3. Disable all Macros except digitally signed Macros.

#4. Enable all Macros.

Specify General Macro Security Settings


You specify macro security settings through the Trust Center dialog box.

17
Introduction to Excel Macro Security and Storage

To specify whether macros are enabled or disabled by default, follow these steps:

#1. Click the Macro Security button in the Developer tab of the Ribbon. I explain
the process to get Excel to display the Developer tab in Create Excel Macros
Without Programming.

Figure 2: To enable/disable macros (step #1): Go to Developer → Macro Security.

#2. Excel displays the Macro Settings tab of the Trust Center dialog box.

#3. Specify whether macros are enabled or disabled by default by selecting the
appropriate option on the upper-right section of the Trust Center dialog box.

#4. Click the OK button.

Figure 3: To enable/disable macros (steps #2 to #4): Specify Macro Settings → click OK.

The Four Global Macro Security Settings


In a previous Section, you learned that there are four Global Macro Security
Settings. These settings have self-explanatory names, as follows:

#1. Disable all Macros without notification prevents macros from running.

#2. Disable all Macros with notification:

18
Introduction to Excel Macro Security and Storage

• Prevents macros from running;

• Displays a notification; and

• Allows you to enable those macros.

#3. Disable all Macros except digitally signed Macros disables all unsigned
macros.

#4. Enable all Macros enables all macros. As stated in the Trust Center, this
setting is generally not recommended as potentially dangerous code can run.

Figure 4: The four Global Macro Security Settings.

Global Macro Security Settings can be overrun by more specific settings or features,
such as:

• Trusted Documents;

• Trusted Locations; and

• Trusted Publishers.

Disable All Macros With Notification


Disable all Macros with notification is:

• The default Global Macro Security setting; and

• The most-commonly recommended Global Macro Security setting.

Disable all Macros with notification is commonly recommended because it is usually


considered to strike a reasonable balance.

• On the one hand, this security setting is high enough to reduce the risks
generated by malicious code.

• On the other hand, this security setting still allows you to work with macros
and VBA.

As you learned in a previous Section, when macros are disabled with notification:

19
Introduction to Excel Macro Security and Storage

• Macros are prevented from running; but

• Excel displays a security warning that allows you to decide whether to enable
or not the macros and other content of the workbook.

The way in which Excel displays the security warning depends on whether the Visual
Basic Editor (VBE) is open or not. Working with the VBE is a more advanced topic.
For purposes of this Book, is enough for you to understand the following:

• If the VBE is open, Excel displays the Microsoft Excel Security Notice dialog
box. This dialog box contains two buttons:

• Enable Macros; and

• Disable Macros.

Figure 5: The Microsoft Excel Security Notice dialog box.

• If the VBE is not open, Excel displays the security warning in a yellow bar below
the Ribbon and above the Formula bar. The warning states that macros have
been disabled.

• You can enable macros by clicking the Enable Content button.

• Alternatively, you can ignore or dismiss the warning by clicking the Close
button that appears on the right side of the yellow bar. This keeps macros
disabled.

Figure 6: Excel displays the security warning below the Ribbon.

20
Introduction to Excel Macro Security and Storage

Executing a Macro When Macros are Disabled

If you attempt to execute a macro in a workbook for which macros are disabled,
Excel:

• Does not execute the macro; and

• Informs you that macros are disabled.

Figure 7: Message box displayed by Excel when you attempt to execute a macro in a workbook for which macros are
disabled.

If you want to enable macros for such a workbook, you must usually proceed as
explained in the message box displayed by Excel. In other words, you must:

#1. Close the workbook;

#2. Reopen the workbook; and

#3. Enable macros when Excel displays the appropriate security warning (as you
learned in the previous Section).

Trusted Documents

An important aspect of macro security is that Excel generally remembers the


decision you take to enable or disable macros for a specific workbook. In other
words, when you enable macros, Excel considers that file to be a Trusted
Document.

This is because Excel assumes that, if you trust a workbook by enabling macros,
you:

• Consider the workbook to be safe; and

• Are likely to continue trusting the workbook and enabling its macros in future
opportunities.

Trusted Document settings override the Global Macro Security Settings you learned
about in a previous Section. Therefore, when you open a Trusted Document from
your computer:

• Excel does not usually display a security warning; and

21
Introduction to Excel Macro Security and Storage

• Macros and other active content are automatically enabled.

Excel workbooks with macros created by yourself become Trusted Documents


automatically. When you open these files from your computer:

• Excel does not usually display security warnings; and

• Macros are generally enabled by default.

In other words, enabling macros is not the only way in which a workbook can
become a Trusted Document.

Summary and Key Concepts


• Excel has the following four Global Macro Security Settings, which are one of
the pillars of macro security.

#1. Disable all Macros without notification: Prevents macros from running.

#2. Disable all Macros with notification:

• Prevents macros from running;

• Displays a notification; and

• Allows you to enable macros.

#3. Disable all Macros except digitally signed Macros: Disables all unsigned
macros.

#4. Enable all Macros: Enables all macros. This setting is generally not
recommended.

• Disable all Macros with notification is:

• The default Global Macro Security setting; and

• The most-commonly recommended Global Macro Security setting.

• You specify macro security settings through the Trust Center dialog box.

• Use the Macro Security button in the Developer tab to display the Trust Center
dialog box.

• Global Macro Security Settings can be overrun by more specific settings or


features.

• Trusted Document settings override Global Macro Security Settings.

22
Introduction to Excel Macro Security and Storage

• An Excel workbook usually becomes a Trusted Document in one of the following


ways:

#1. After you enable macros for that workbook.

#2. If you create the workbook.

• When you open a Trusted Document from your computer:

• Excel does not usually display a security warning; and

• Macros are generally enabled by default.

23
Introduction to Excel Macro Security and Storage

Chapter 3: Trusted Locations and Trusted


Publishers
In this Chapter, you learn:

• What Trusted Locations and Trusted Publishers are.

• The consequences of designating a folder as a Trusted Location.

• How to specify Trusted Locations.

• Some considerations and rules to help you appropriately choose folders to


designate as Trusted Locations.

Introduction
In Chapter 2, you learned how to specify Global Macro Security Settings. Trusted
Locations add an extra dimension to your macro security settings and setup.

For example, if you specify that Excel must disable all macros with notification (the
default Global Macro Security setting), you may want to avoid having to deal with
individual workbooks. Trusted Locations can help you with this.

Trusted Locations
Trusted Locations are folders you specify as safe. The Excel workbooks you save in
such folders are those you trust.

Excel opens workbooks stored in a Trusted Location:

• Without displaying security warnings; and

• With enabled macros.

In other words, Trusted Locations are:

• An exception; and

• Override Global Macro Security Settings.

Global Macro Security Settings continue to apply to Excel workbooks that are not
stored in a Trusted Location.

24
Introduction to Excel Macro Security and Storage

Specify a Trusted Location


Specify a Trusted Location by following these steps:

#1. Click the Macro Security button in the Developer tab of the Ribbon.

Figure 8: To specify a Trusted Location (step #1): Go to Developer → Macro Security.

#2. Excel displays the Trust Center dialog box.

#3. Click the Trusted Locations tab, near the top of the Navigation pane on the
left side of the Trust Center dialog box.

#4. Click the Add new location button.

Figure 9: To specify a Trusted Location (steps #2 to #4): Go to Trusted Locations → click Add new location.

#5. Excel displays the Microsoft Office Trusted Location dialog box.

#6. Click the Browse button.

25
Introduction to Excel Macro Security and Storage

Figure 10: To specify a Trusted Location (steps #5 and #6): Click Browse.

#7. Excel displays the Browse dialog box.

#8. Use the Browse dialog box to browse to the parent folder of the folder you
want to designate as a Trusted Location.

#9. Select the folder you want to designate as a Trusted Location.

#10. Click the OK button.

Figure 11: To specify a Trusted Location (steps #7 to #10): Select folder you want to designate as Trusted Location →
click OK.

#11. If you want to trust the subfolders of the folder you designated as a new
Trusted Location, place a checkmark on the Subfolders of this location are also
trusted check box. This step is optional.

#12. If you want to add a description, enter it in the Description field. This step
is optional.

#13. Click the OK button to close the Microsoft Office Trusted Location dialog
box.

26
Introduction to Excel Macro Security and Storage

Figure 12: To specify a Trusted Location (steps #11 to #13): Select whether to trust subfolders of location (optional)
→ enter description (optional) → click OK.

#14. Click the OK button to close the Trust Center dialog box.

Figure 13: To specify a Trusted Location (step #14): Click OK.

How to Choose Folders to Designate as Trusted Locations


You generally want to be careful when designating folders as Trusted Locations.

Global Macro Security Settings, such as enabling or disabling macros, are there to
protect you and your computer. Trusted Locations are an exception to these general
security rules. You, therefore, want to be mindful of your choices.

Consider the following two types of folders:

#1. The folders on your network.

#2. The folders where your computer stores downloaded files.

27
Introduction to Excel Macro Security and Storage

You can allow trusted network locations from the Trust Center dialog box. To do
this, you place a check mark on the Allow Trusted Locations on my network (not
recommended) check box.

Figure 14: Allow Trusted Locations on my network (not recommended).

However, as stated in the label, allowing trusted network locations is usually not
recommended. In other words, Microsoft’s suggestion is to keep Trusted Locations
on your hard drive.

In any case, certain folders in your hard drive are generally not suitable to be
designated as Trusted Locations. The folders where your computer stores
downloaded files (which may be risky) are one such type of folder that, as a general
rule, should not be designated as Trusted Locations. More generally, you usually
do not want to specify a broad Trusted Location that would cover such folders (for
example, your entire hard drive).

The following are two basic rules you can consider when designating Trusted
Locations:

#1. Only designate folders within your hard drive (not on your network) as
Trusted Locations.

#2. When designating folders as Trusted Locations, be as restrictive and specific


as possible.

28
Introduction to Excel Macro Security and Storage

Introduction to Trusted Publishers


In addition to Trusted Documents (which you learned about in Chapter 2) and
Trusted Locations (which you learned about in this Chapter), Excel uses the figure
of Trusted Publishers.

Trusted Publishers work through Digital Signatures.

The topic of Trusted Publishers and Digital Signatures is important at more


advanced levels. For example, if you want to become a professional Excel
Developer and sell Add-ins and other Applications, you may need a Digital Signing
Tool. This reduces the risk of your macros not working properly because of the
Global Macro Security Settings of your clients.

If your plan is to create macros to be used by yourself and a few other people, you
probably do not need to deal with Digital Signing Tools (yet).

Summary and Key Concepts


• Trusted Locations are folders you specify as safe.

• Excel opens workbooks stored in a Trusted Location:

• Without displaying security warnings; and

• With enabled macros.

• You specify Trusted Locations through the Trust Center dialog box.

• Since Trusted Locations are an exception (and override) Global Macro Security
Settings, you want to be careful when designating folders as Trusted Locations.
The following two basic rules may help you appropriately choose Trusted
Locations:

#1. Only designate folders within your hard drive (not on your network) as
Trusted Locations.

#2. When designating folders as Trusted Locations, be as restrictive and


specific as possible.

• Excel also uses the figure of Trusted Publishers (which relies on Digital
Signatures) for macro security purposes. This topic is important at more
advanced levels.

29
Introduction to Excel Macro Security and Storage

Chapter 4: Excel File Types


In this Chapter, you learn:

• What the four Excel file types are.

• The main characteristics of each Excel file type.

• Which Excel workbooks can contain macros and which Excel workbooks cannot
contain macros.

• How to identify whether an Excel workbook may contain macros or not.

• How to save an Excel workbook containing macros.

• How to change the default file type Excel uses to save workbooks.

Introduction to Excel File Types


As I explain in Create Excel Macros Without Programming, not all Excel files can
contain macros. This is an important security feature with wide-reaching
implications.

At a basic level, the fact that not all Excel files can contain macros helps you control
your own security. At a broader level, this influences the file formats you can use
when working with macros and VBA.

Excel File Types


Generally, Excel files are saved using one of the following four file types:

File type File Can Additional comments


extension contain
macros?

1 Regular Excel .xlsx No • Default file format.


Workbook

2 Excel Macro- .xlsm Yes • Similar to .xlsx files.


Enabled
• Main difference between .xlsx and .xlsm files
Workbook
is that .xlsm files can contain macros while
.xlsx files cannot contain macros.

3 Excel Binary .xlsb Yes • File size is generally smaller than both .xlsx
Workbook and .xlsm files.

30
Introduction to Excel Macro Security and Storage

• Files are usually faster (both loading and


carrying out calculations) than both .xlsx and
.xlsm files.

• More prone to corruption than both .xlsx and


.xlsm files. This increases the risk of losing
your work.

4 Excel 97-2003 .xls Yes • Exists mostly for compatibility purposes.


Workbook
• With Office 2007, Microsoft changed the basic
file structure to XML (eXtensible Markup
Language), whose main purpose is to store and
transport data.

•.xls files can be opened in older (pre-2007)


versions of Excel.
Figure 15: Excel file types.

To summarize:

• The default/regular Excel Workbook file type (.xlsx extension) cannot contain
macros.

• Macro-Enabled, Binary and Excel 97-2003 Workbooks (.xlsm, .xlsb and .xls
extensions) can contain macros.

Distinguishing File Types is Important


The differences between the four Excel file types is helpful in terms of security. This
is because you can quickly identify whether an Excel file may contain macros or not
by simply checking its extension. Consider how useful this is if you work with files
you get through email or download from the Internet.

To check the file extension of an Excel workbook, follow these steps:

#1. Right-click the Excel workbook.

#2. Windows displays a context menu.

#3. Select Properties in the context menu.

31
Introduction to Excel Macro Security and Storage

Figure 16: To check a workbook's file extension (steps #1 to #3): Right-click → select Properties.

#4. Windows displays the file's properties. The workbook’s file type (Type of file)
is near the top of the General tab (which Windows displays by default).

Figure 17: To check a workbook's file extension (step #4): A workbook's file type is displayed near the top of the
General tab.

Save Excel Workbooks Containing Macros


You generally save Excel workbooks as follows:

• Use the default/regular Excel Workbook file type (.xlsx extension) to save
workbooks that do not contain macros.

• Use Macro-Enabled Workbooks (.xlsm extension) to save workbooks that


contain macros.

Since Macro-Enabled Workbooks are not the default, you must usually specify this
format explicitly.

To save an Excel Workbook containing macros, follow these steps:

32
Introduction to Excel Macro Security and Storage

#1. Open the Save As dialog box by, for example, using the F12 keyboard
shortcut. This keyboard shortcut works for English (United States) language
settings. Depending on your language settings, you may have to use a different
keyboard shortcut to achieve the same result.

#2. Specify the file name in the File name field.

Figure 18: To save a workbook containing macros (steps #1 and #2): Open the Save As dialog box → specify file
name.

#3. Expand the Save as type drop-down list.

#4. Select Excel Macro-Enabled Workbook.

Figure 19: To save a workbook containing macros (steps #3 and #4): Expand Save as type drop-down list → select
Excel Macro-Enabled Workbook.

#5. Click the Save button.

33
Introduction to Excel Macro Security and Storage

Figure 20: To save a workbook containing macros (step #5): Click Save.

Change the Default File Type of Excel Workbooks


As you learned in this Chapter, Excel saves workbooks as regular Excel Workbooks
(.xlsx extension) by default.

To change the default file type Excel uses to save workbooks, follow these steps:

#1. Go to the Backstage View by, for example, clicking the File tab of the Ribbon.

Figure 21: To change the default file type (step #1): Go to File.

#2. Select Options near the bottom of the left navigation pane.

Figure 22: To change the default file type (step #2): Select Options.

34
Introduction to Excel Macro Security and Storage

#3. Excel displays the Excel Options dialog box.

#4. Select the Save tab in the navigation pane on the left of the Options dialog
box.

#5. Use the Save files in this format drop-down list to select the file type you
want to set as default. In most cases, this is either:

• Excel Workbook; or

• Excel Macro-Enabled Workbook.

If you are going to be working with macros often, you may want to specify Excel
Macro-Enabled Workbook.

Figure 23: To change the default file type (steps #3 to #5): Go to Save → Select file type using Save files in this
format drop-down list.

#6. Click the OK button.

35
Introduction to Excel Macro Security and Storage

Figure 24: To change the default file type (step #6): Click OK.

Summary and Key Concepts


• You can save Excel files using one of the following four file types:

#1. Regular Excel Workbook (.xlsx extension).

#2. Excel Macro-Enabled Workbooks (.xlsm extension).

#3. Excel Binary Workbook (.xlsb extension).

#4. Excel 97-2003 Workbook (.xls extension).

• The default/regular Excel Workbook file type (.xlsx extension) cannot contain
macros. The other three file types (.xlsm, .xlsb and .xls extensions) can contain
macros.

• By checking an Excel workbook’s file extension, you can identify whether the
file may contain macros or not.

• To save an Excel workbook containing macros, select Excel Macro-Enabled


Workbook from the Save as type drop-down list in the Save As dialog box.

• You can change the default file type Excel uses to save workbooks from the
Save tab in the Excel Options dialog box.

36
Introduction to Excel Macro Security and Storage

Chapter 5: The Personal Macro Workbook


In this Chapter, you learn:

• What the Personal Macro Workbook is.

• Why/how the Personal Macro Workbook can help you.

• How to use the Personal Macro Workbook.

• How to create your Personal Macro Workbook.

• How to unhide the Personal Macro Workbook.

• How to save changes to the Personal Macro Workbook.

Introduction to the Personal Macro Workbook


The Personal Macro Workbook acts as a central macro container.

In other words, you use the Personal Macro Workbook to store commonly-used
macros. This can be very useful, as it allows you to easily work with those macros
across different workbooks.

The Personal Macro Workbook is a special workbook. It has two unique


characteristics:

#1. It is usually hidden.

#2. It is automatically opened every time you work with Excel.

These two characteristics are what make the Personal Macro Workbook a great
centralized macro storage:

#1. You do not need to remember to open the workbook. The macros stored in
the Personal Macro Workbook are automatically available when you work with
Excel.

#2. Since the Personal Macro Workbook is usually hidden, it does not disturb or
get in the way of your work.

When to Use the Personal Macro Workbook


As you learned in the previous Section, the Personal Macro Workbook is commonly
used to store general-purpose macros that you commonly work with regardless of
the workbook that is open.

37
Introduction to Excel Macro Security and Storage

You (usually) do not use the Personal Macro Workbook to store specific macros that
you create or use in a specific file or workbook.

How to Create Your Personal Macro Workbook


You create your Personal Macro Workbook by:

#1. Recording a macro; and

#2. Storing the macro in the Personal Macro Workbook.

I explain the process you follow to record a macro and select the workbook in which
it is stored in Create Excel Macros Without Programming.

To create your Personal Macro Workbook, follow these steps:

#1. Click the Record Macro button in:

• The Developer tab; or

• The left side of the Status bar.

Figure 25: To create the Personal Macro Workbook (step #1): Click the Record Macro button.

#2. Excel displays the Record Macro dialog box.

#3. Expand the Store macro in drop-down list and select Personal Macro
Workbook.

#4. Click the OK button.

38
Introduction to Excel Macro Security and Storage

Figure 26: To create the Personal Macro Workbook (steps #2 to #4): Expand Store macro in drop-down list → select
Personal Macro Workbook → click OK.

#5. Click the Stop Recording button in:

• The Developer tab; or

• The left side of the Status bar.

Figure 27: To create the Personal Macro Workbook (step #5): Click the Stop Recording button.

The macro you recorded is empty. Therefore, you can later:

#1. Go into the Personal Macro Workbook; and

#2. Delete the VBA code generated by the Macro Recorder.

Unhide the Personal Macro Workbook


After you have created the Personal Macro Workbook, you can unhide it.

To unhide the Personal Macro Workbook, follow these steps:

#1. Click the Unhide button in the View tab of the Ribbon.

39
Introduction to Excel Macro Security and Storage

Figure 28: To unhide the Personal Macro Workbook (step #1): Go to View → Unhide.

#2. Excel displays the Unhide dialog box.

#3. Select PERSONAL.

#4. Click the OK button.

Figure 29: To unhide the Personal Macro Workbook (steps #2 to #4): Select PERSONAL → click OK.

After you complete the process I describe above, Excel displays the Personal Macro
Workbook. This workbook looks like a regular workbook with an empty worksheet.

Figure 30: The Personal Macro Workbook.

40
Introduction to Excel Macro Security and Storage

Save Changes to the Personal Macro Workbook


When you close Excel after modifying the Personal Macro Workbook, Excel usually
asks whether you want to save those changes.

To ensure the modified macros are available the next time you work with Excel,
click the Save button.

Figure 31: When closing Excel, save changes to the Personal Macro Workbook.

Summary and Key Concepts


• The Personal Macro Workbook has two unique characteristics:

#1. It is usually hidden.

#2. It is automatically opened every time you work with Excel.

• Use the Personal Macro Workbook to store macros you commonly work with
across different workbooks.

• Create your Personal Macro Workbook by:

#1. Recording a macro; and

#2. Storing the macro in the Personal Macro Workbook.

• You can unhide the Personal Macro Workbook by working with the Unhide
dialog box.

• To ensure the modifications you make to the macros stored in your Personal
Macro Workbook are available the next time you work with Excel, save those
changes when Excel asks you.

41
Introduction to Excel Macro Security and Storage

Next Steps
If you have made it this far into the Book, I hope you have found it useful and
enjoyable.

After reading this Book, you probably know how to work with the main Excel macro
and VBA security features and storage options to:

• Reduce the risks that macros and VBA may generate; and

• Increase your power and efficiency when working with macros and VBA.

This includes, among others:

• Why and how macros and VBA can be intentionally or unintentionally misused
and cause damage.

• Why you cannot fully eliminate the risks associated to working with Excel files,
even if you do not use macros or VBA.

• What the four main Excel macro and VBA security-related features are.

• How to enable or disable macros by default by specifying Global Macro Security


Settings.

• What the four Global Macro Security Settings are.

• How an Excel workbook may become a Trusted Document, and the


consequences this has.

• What Trusted Locations and Trusted Publishers are.

• How to specify Trusted Locations, and the consequences this has.

• What the four Excel file types are.

• How to identify whether an Excel workbook may contain macros or not.

• How to save an Excel workbook containing macros.

• How to change the default file type Excel uses to save workbooks.

• What the Personal Macro Workbook is.

• How/when to use the Personal Macro Workbook.

• How to create your Personal Macro Workbook.

42
Introduction to Excel Macro Security and Storage

•How to save changes to the Personal Macro Workbook.

Although this Book has ended, our conversation about Excel macros and VBA has
only begun. I am constantly creating training materials to help you become an
Excel Power User.

There are numerous other places we can continue our work together.

You can find my other Books about Excel and VBA (including the other Books in the
Excel Macros for Beginners Series) at Amazon.com.

You can join my Free Course for Excel macro beginners, Introduction to Excel
Macros, by subscribing to the Power Spreadsheets Newsletter.

I also provide a Premium Course for Excel users who have little or no
experience/knowledge about macros or VBA: Excel Macros for Beginners. If you
would like to be the first to know when the doors to Excel Macros for Beginners
open again, you can learn more about the Course and join the waitlist here.

PowerSpreadsheets.com contains Tutorials, links and other resources to help you


become an Excel Power User. You can visit the organized Archives here.

I Want to Hear from You!


I loved writing this Book and cannot thank you enough for your support. I
appreciate you for taking time out of your day to read this Book.

If you have a few seconds, I would love to read what you think about it. As the
reader of this Book, you are my most important reviewer and commentator. I value
your opinion and want to know:

• What I am doing right;

• What I could do better;

• What Excel topics you would like me to write about; and

• Any other wise advice you are willing to share with me.

If you enjoyed this Book, please give it an honest review on Amazon.com. This
helps others learn about Excel macros and VBA, allowing them to become more
efficient and powerful Excel users, positively impacting their own lives and the
broader world.

You can also leave a testimonial at PowerSpreadsheets.com.

43
Introduction to Excel Macro Security and Storage

I:

• Read all reviews and testimonials; and

• Take them into consideration when creating or updating books (such as this
one) or the rest of the training materials at Power Spreadsheets.

By leaving a review or testimonial, you help me serve you better.

Thanks again for your support. I wish you much success with Excel, macros and
VBA. Until next time,

44

You might also like