Situatie
Before you enable macros in your worksheets, you should understand how dangerous they can be.
Though VBA (Visual Basic for Applications) codes are extremely effective at automating complex and repetitive tasks, they pose a significant security risk. Unintentionally running a malicious macro can damage or completely delete files on your hard drive, corrupt your data, and even corrupt your Microsoft Office installation. As a result, the default setting in Excel is to disable all macros with notification.
Solutie
Pasi de urmat
How to Enable macros for individual workbooks?
Macros can be enabled for a specific file in two ways: directly from the workbook and via the Backstage view.
Enable macros directly via security notice:
When you first open a workbook containing macros with the default macro settings, the yellow security warning bar appears at the top of the sheet, right under the ribbon:
The Microsoft Excel Security Notice will be displayed if the Visual Basic Editor is open at the time you open the file with macros:
If you are confident in the file’s origin and that all macros are safe, click the Enable Content or Enable Macros button. This activates the macros and marks the file as a trusted document.
Turn on macros in Backstage view:
The Office Backstage view is another way to enable macros for a specific workbook. Here’s how to do it:
- Click the File tab, then Info from the left menu.
- Click Enable Content > Enable All Content, in the Security Warning area.
Your workbook, like the previous method, will become a trusted document.
How to Enable macros for one session?
In some cases, enabling macros for a single instance makes sense. For example, suppose you received an Excel file containing VBA code that you want to investigate but do not want to make it a trusted document.
The steps below will walk you through the process of enabling macros for the duration of the file’s open state:
- Navigate to the File tab > Info.
- Click Enable Content > Advanced Options in the Security Warning area.
- Select Enable content for this session in the Microsoft Office Security Options dialogue box, then click OK.
This enables macros for a single-use. The warning will reappear if you close and then reopen the workbook.
Leave A Comment?