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
- Login or register to post comments
- 5188 reads
Recent comments
5 years 36 weeks ago
6 years 22 weeks ago
6 years 34 weeks ago
6 years 37 weeks ago
6 years 38 weeks ago
6 years 43 weeks ago
6 years 52 weeks ago
7 years 2 days ago
7 years 3 days ago
7 years 3 days ago