Get the value of a variable

How can I get the value of a variable declared in xls padlock - vba compiler and use it in VBE?

Sure, you can do this:

  1. in XLS Padlock VBA Compiler, type this:

    Function RetrieveMyVariable
    RetrieveMyVariable = 50 'Anything you want to return
    End Function

For instance, we want to retrieve 50.
Click Compile Code and close the compiler’s window:

  1. Open VBE and in the workbook’s code (for instance a module), type this:

    Sub RetrieveFromVBACompiler()
    Dim XLSPadlock As Object
    Set XLSPadlock = Application.COMAddIns(“GXLSForm.GXLSFormula”).Object
    MsgBox XLSPadlock.PLEvalVBA(“RetrieveMyVariable”, “”)
    Set XLSPadlock = Nothing
    End Sub

That’s all. Even if you execute the VBA procedure RetrieveFromVBACompiler from VBE, it will work:

We were able to import a variable from the VBA compiler and retrieve it from usual VBA code in VBE.