VBA & Macro Problems

Excel Workbook Protection: Create an Audit Log

Elise WilliamsElise Williams Nov 12, 2026 869 views

Question details

The user wants to know whether Excel's Protect Workbook feature records protection activity or creates a change history.

Product
Microsoft Excel
Device & OS
not provided
Scenario
The user needs an audit trail for workbook openings, sheet changes, protection activity, or other workbook events.
Observed behavior
Excel's built-in workbook protection does not automatically create an audit log or change history, and it has no dedicated event for protection changes.
Before you start

Define which actions must be recorded, such as workbook openings, sheet changes, and user names. If you plan to use VBA, confirm that macros are allowed and identify whether the log will be stored in a worksheet, an external file, or another destination.

Solution 1Recommended

Use custom VBA events to build an Excel activity log

Use this approach when you need a custom audit trail for workbook openings, sheet changes, or other supported events.

Protect Workbook does not include a native audit-log feature. A VBA project can call a custom logging procedure from workbook and worksheet events, but Excel does not provide a standard event dedicated to changes in workbook protection. The logging design must therefore be adapted and tested for the required scenario.

1
Enable the Developer tab

In Excel, select File > Options > Customize Ribbon, enable Developer, and select OK.

2
Open the VBA editor

Select Developer > Visual Basic, then open ThisWorkbook in the Project Explorer.

3
Add event-based logging

Add Workbook_Open or other supported workbook events, and call a custom LogChange procedure that writes the timestamp, user, workbook, sheet, and action to a log worksheet, file, or the Immediate window.

4
Test protection scenarios

Return to Excel, save the workbook as an Excel Macro-Enabled Workbook (*.xlsm), enable macros, and test workbook opening, sheet changes, and Protect Workbook actions to confirm what is recorded.

Protection changes need special handling: Excel has no dedicated event that fires specifically when workbook protection is enabled, disabled, or modified. A VBA audit design cannot rely on a native protection-change event alone.
Free Microsoft Office alternative

Edit and manage compatible Excel workbooks with WPS Office

WPS Office is a free, lightweight alternative for opening, editing, and sharing common Excel workbooks with a familiar interface. It supports widely used Microsoft Office formats for easier migration, although Excel-specific VBA audit behavior and protection-change events should be tested separately.

  1. 1. Install WPS Office: Download and install WPS Office, then open WPS Spreadsheets from the Start menu or applications folder.
  2. 2. Open the workbook: Select Open from the home screen and choose the compatible .xlsx or .xls workbook you want to review or edit.
  3. 3. Review workbook protection: Use the Review tab to inspect available sheet or workbook protection controls, and test the file with a copy before relying on it for protected workflows.
Open and edit common .xlsx and .xls workbooks with a familiar spreadsheet interfaceLightweight and free for everyday spreadsheet tasksCompatible with Microsoft Excel .xlsx and .xls formats for smoother file sharingReview workbook content and formatting without requiring a full Microsoft Office installation
microsoft office alternative - wps office

Frequently Asked Questions

Does Excel Protect Workbook automatically record who changed protection settings?

No. Protect Workbook prevents or restricts structural changes, but it does not automatically record users, timestamps, protection changes, or a history of activity.

Can VBA create an audit log for Excel workbook activity?

Yes. VBA can write information from events such as Workbook_Open, sheet activation, and worksheet changes to a worksheet, external file, or the Immediate window. The logging code must be designed for the required actions.

Is there an Excel event for enabling or disabling workbook protection?

No. Excel does not provide a standard event dedicated to changes in workbook protection, so a VBA solution must use other events or custom checks and should be thoroughly tested.

Where can a VBA audit log store recorded activity?

A logging procedure can write records to a hidden or visible worksheet, a text or CSV file, or the VBA Immediate window. Choose a destination that users cannot easily overwrite if the log must support auditing.

What file type is needed for an Excel VBA audit system?

Save the workbook as an Excel Macro-Enabled Workbook (*.xlsm) so the VBA project can be retained. Users must also enable macros for the event-based logging code to run.