» Check if a VBProject is protected using VBA in Microsoft Excel
VBA macro tip contributed by Erlandsen Data Consulting offering Microsoft Excel Application development, template customization, support and training solutions
CATEGORY - Protecting in VBA
VERSION - All Microsoft Excel Versions
Function ProtectedVBProject(ByVal wb As Workbook) As Boolean
' returns TRUE if the VB project in the active document is protected
Dim VBC As Integer
VBC = -1
On Error Resume Next
VBC = wb.VBProject.VBComponents.Count
On Error GoTo 0
If VBC = -1 Then
ProtectedVBProject = True
Else
ProtectedVBProject = False
End If
End Function
Example:
If ProtectedVBProject(ActiveWorkbook) Then Exit Sub
Book Store:
Recommended Books:
- Microsoft Office Xp: Advanced Concepts and Techniques: Word 2002, Excel 2002, Access 2002, Powerpoint 2002
- Microsoft Excel 2002 Formulas (With CD-ROM)
- Financial Statement Analysis with S&P insert card
- Special Edition Using Microsoft Outlook 2002
- Microsoft Windows XP Registry Guide
- Special Edition Using Microsoft Access 2002
No comments have been submitted.

