Macro Security
- 04:10
Understand the security implications of opening files containing Macros
Downloads
No associated resources to download.
Glossary
.xlsm Enable All Macros File Extensions Trust Center VBATranscript
So macros, as well as being able to adjust things about Excel in the Excel environment, they can also affect your computer. And because of that, Excel has some security features that we need to talk about to make sure you protect yourself from malicious code. The first way is by the file extension. So when you save a workbook, which has macros in it, if you try and save it as an XLSX file, a normal Excel file.
I was gonna do this so you can see the message come up. Let's do a save as. Let me change it to XLSX and click save. You'll see we get a message or warning message saying that we can't save a workbook which has macros in it with the XLSX file extension. we must change it to an XLSM file extension, so it has an M on the end indicating that it's got macros in it. So how does this protect us? Well, as soon as we see a file that we're about to open, even before we open it, we can see by its file extension that it is a workbook which potentially contains macros. If we are not so sure of its source or where it came from and we don't expect it to contain macros, then before we even open it we should probably go back to the person who sent it to us and ask them what the macros are for. Did they know it contained the macros? And make sure that they are safe to use and appropriate for us to open.
So that's the file extension. I'm just gonna click no here.
The next way that Excel protects us against malicious macros is in some security settings that we set inside of Excel. You can get to these via the file menu in options, but there's a shorter way to go, and that's via the developer ribbon. So let's go and have a look at that. On the developer ribbon, there's a macro security setting here. And this takes us into the Trust Center options. These macro settings at the top, we've got four options: disable all macros without notification, disable all macros with a notification, disable all macros except digitally signed macros, and enable all macros full stop. Notice that this says not recommended, potentially dangerous. Okay, so you should never, ever change this to enable all macros.
The safest approach is to do the default setting, which is disable all macros with a notification. And all that means is that when you open a file that contains macros, it will warn you. So you'll get a little popup to say, this book contains macros, do you want to enable them? You can then enable them if you want to, and then you are ready to proceed. So that's the safest way to approach this. Leave it on disable macros with notification.
Now, it can be tempting if I work with macros a lot and I work with workbooks that contain a lot of macros, it can be tempting to switch this to enable all macros because these warning boxes every time I open up Excel files can be annoying. But you shouldn't do that. What you should do instead is you should set up a trusted location. So let's go and have a look at that. If you go to trusted locations, you'll see there are a number of existing locations which Excel sets up by default as trusted, but you can go and add your own as well. And any files that are in a folder which is a trusted location won't warn you about macros. So it's like little safe spaces that you set up that say I know these files are safe because they're trusted and I use them all the time. So you can get around the warning messages that you receive all the time, but also keep yourself safe.