Find out if VBA Project is Protected

Find out if VBA Project is Protected in C#

You can determine whether the VBA (Visual Basic for Applications) project of your Excel file is protected using Aspose.Cells and the VbaProject.IsProtected property.

Sample Code

The following sample code creates a workbook and then checks whether its VBA project is protected. It then protects the VBA project and checks again. Please see the console output for reference. Before protection, VbaProject.IsProtected returns false, but after protection it returns true.

Console Output

The console output of the above sample code is shown for reference.

IsProtected - Before Protecting VBA Project: False

IsProtected - After Protecting VBA Project: True