Check if VBProject is protected

This code lets you know whether the VB project is protected or not
Add a reference to the Microsoft Visual Basic Extensibility Library
It returns TRUE if the VB project in the active document is protected
Function ProtectedVBProject(ByVal wb As Workbook) As Boolean Dim intVBComp As Integer intVBComp = -1 On Error Resume Next intVBComp = wb.VBProject.VBComponents.Count If Err.Number = 1004 Then MsgBox "Add reference to the Microsoft Visual Basic Extensibility Library", vbCritical, "Excel Experts" End If On Error GoTo 0 If intVBComp = -1 Then ProtectedVBProject = True Else ProtectedVBProject = False End If End Function
»
- Vishesh's blog
- Add new comment
- 810 reads

Recent comments
3 hours 25 min ago
10 hours 16 min ago
9 hours 31 min ago
12 hours 34 min ago
22 hours 54 min ago
1 day 2 hours ago
1 day 2 hours ago
1 day 8 hours ago
1 day 9 hours ago
2 days 23 min ago