Purpose: test if the workbook is protected with XLS Padlock

In a module, insert the following code:

Public Function XLSPadlockAvailable() As Boolean
Dim XLSPadlock As Object
On Error Resume Next
Set XLSPadlock = Application.COMAddIns("GXLSForm.GXLSFormula").Object
XLSPadlockAvailable = XLSPadlock.IsProtected()
End Function
 

 

You can then call the function:

Sub Test_Protected()
 If XLSPadlockAvailable() Then
  MsgBox "Protected"
 Else
  MsgBox "Not Protected"
 End If
End Sub