XLS Padlock VBA code protection

Hello!
When I try to protect a sub then I get the error that res is a variable without definition.

Sub abc()
Dim res As String
res = CallXLSPadlockVBA(“abc”, “”)
End Sub

'This function lets you call VBA macros compiled with XLS Padlock
Public Function CallXLSPadlockVBA(ID As String, Param1)
Dim XLSPadlock As Object
Set XLSPadlock = Application.COMAddIns(“GXLSForm.GXLSFormula”).Object
CallXLSPadlockVBA = XLSPadlock.PLEvalVBA(ID, Param1)
Set XLSPadlock = Nothing
End Function

What can I do?
Thank you very much!

Sub abc()
Dim res As String
res = CallXLSPadlockVBA(“abc”, “”)
End Sub

Where do you place this code? Is it in your VBA Editor or in the XLS Padlock’s VBA compiler window?

Hello, thank you very much for your answer. It is in my VBA Editor. With Dim res as String I got an error because of 0. But in the morning I tried Dim res without anything and it seems to work.

1 Like