VBA Security in Excel

Home/Excel VBA/VBA Security in Excel

It is important to understand the macro or VBA Security in Excel if you are dealing with the Macro Enabled Files. It helps to protect your data from the malicious programs and helps to know how to run the macros when its required.

PREMIUM TEMPLATES LIMITED TIME OFFER

ON SALE80% OFF

50+ Project Management Templates Pack
Excel PowerPoint Word

Advanced Project Plan & Portfolio Template
Excel Template

Business Presentations Templates Pack
PowerPoint Slides

20+ Excel Project Management Pack
Excel Templates

20+ PowerPoint Project Management Pack
PowerPoint Templates

10+ MS Word Project Management Pack
Word Templates


In this Section:

Understanding VBA Security in Excel

It is important to understand the macro security if you are dealing with the Macro Enabled Files. It helps to protect your data from the malicious programs and helps to know how to run the macros when its required.

You can change the security level by clicking on the ‘Macro Security’ button in the ‘Developer’ Tab of the Excel Ribbon.
VBA Security in Excel-1

What Have Different Levels of the Security in VBA?

If you click on the ‘Macro Security’ button, it will open the Trust Center dialog, you can see the four levels of security in the dialog box:
vba-security-2

Security level Description
Disable all macros without notification All macros will be disabled.
Disable all macros with notification When you open a file all the macros will be disabled, but it will be prompted with a message allowing you to enable them each time. This is the recommended option, since you can if you trust the macro file.
Disable all macros except digitally signed macros You won’t be able to run any macros unless they have a trusted digital certificate attached.
Enable all macros All macros will be Enabled as soon as a file is opened. This is not recommended

How to Enable or Disable the Macros?

When you open any macro enabled file, if you have chosen the option “Disable all macros with notification” in the Macro Security Settings. It will prompt for enabling or disabling the macros. If you trust the file you can Enable it or else disable the file.

vba-security-3

How To Protect VBA Code?

If you want to hide your VBA Code, you can protect it by providing a password. Follow the below steps to protect your VBA Code/ Macros:

Step 1: Open the Visual Basic Editor (Alt+F11).
Step 2: Select “VBAProject Properties” in the “Tool” menu within the Visual Basic Editor.

(It will Open the VBAProject Properties Dialog)

Step 3: Go to the “Protection” tab.
Step 4: Select the “Lock Project for Viewing” check box. If you don’t check this box, it won’t hide your code.
Step 5: Provide and confirm your desired password in the indicated boxes. Then Click OK button
Step 6: You are Done! Save, Close, and Reopen your workbook for the protection to take effect.

(Please Note: In Microsoft Excel 2007 and later, You need to save as an XLSM file for your code to save & work, other wise you will loose your code.)

LIMITED TIME OFFER
By |June 1st, 2013|Excel VBA|0 Comments

About the Author:

PNRao is a passionate business analyst and having close to 10 years of experience in Data Mining, Data Analysis and Application Development. This blog is his passion to learn new skills and share his knowledge to make you expertise in Data Analysis (Excel, VBA, SQL, SAS, Statistical Methods, Market Research Methodologies and Data Analysis Techniques).

Leave A Comment


Related pages


excel vba tutorial for beginnersunhide cellsvba excel sample codeworksheets vba excelexcel vba example codetechnical interview questions for freshers with answersexcel macro codehdr yes imex 1if statements excellsimple vlookup formulaexcel vba redim preserveeasy vlookup tutorialexcel templates databaseexcel vba functionshyperlinks vbavba excel databaseunhide lines in excelunprotect powerpointhow to merge and center on excelvba write filevba activexdashboard formats in excelhow to insert a dropdown in excelhow to put password on excel 2007how to find empty cell in excelhow to change width of a column in excelexcel 2007 insert rowexcel if statement rangevba sort listboxdelete macro excelexcel shortcut chartsearching for duplicates in exceliferror in vlookupexcel vba connect to access databasehow to protect a workbook in excel 2007dynamic excel dashboardcountif function in excelpivot table graphexcel macro format cellautofit row height not workingchart tools layout tab excel 2013protecting an excel worksheethow to password protect an excel workbookvba pivot table rangevba xlupsql tutorial for beginners with examples pptmultiple if statements excelhow to create pivot table in excel 2003macro copy pastevb cellsexcel vlookup alternativehow to copy and paste excel sheetwriting vba codehow to create an excel table with headersdrop down menu vbavbscript nested ifhow to lock a sheet in excelvba create folderexcel advanced filter wildcardactivex combo boxapplication vbavba excel open text fileexcel vba do while loopdevelopers tab in excelusing advanced filter in excelvba custom message boxclose form vbavba delete sheetmsgbox vba examplesbasic excel worksheetproject milestone template excellate binding vbahow do i merge columns in excelindirect function in vbahow to make a pivot table in excel 2010unhide excelexcel hide cells