API Functions Help

Problem: I am unable to get any of the XLS Padlock API functions to work properly.

Here are a couple of important notes and tests I’ve run to narrow down the problem. I will use the “PathtoFile” API function as an example.

1.) My excel workbook has the GXLSFormula & XLS Padlock COM Add-ins enabled. The “PathtoFile” function points to either the excel file or a previously compiled .exe file when the excel file is NOT compiled. No problems here as the path is shown with my test code. When I compile the excel and run the same code, the error handler kicks in and does not show a path.

2.) I added a couple of additional error handlers to the code to see if I can find out where is throwing an error. I found that the error occurs when the "XLSPadlock.PLEvalVar(“EXEPath”)& Filename line of code is run.

3.) I tried running the same modified code with the additional error handlers in my excel workbook and I get the same error if I disable the GXLSFormula Add-in.

4.) I’m running the latest 2024.2 XLSPadlock version. I tried installing the 2024.1 version. No luck.

5.) I’ve tried the VPI code in a completely new excel file in case it had to do with one of the XLS Padlock compiler settings. No luck.

I’m thinking that the compiled workbook is not making the connection to the GXLSFormula COM Add-in that allows the XLSPadlock functions to be called. I don’t know why though. It is probably a USER error but I’m running out of tests to perform to figure out the cause. I already spoke with someone from GDG Software and it should be as easy as copy/pasting the code into a sub and referencing the functions as usual. The XLS Padlock compiler should take care of making sure the appropriate COM Add-ins are included and referenced without issue.

Has anyone else had this problem? I’ve run out of ideas so any suggestions, tests, etc. would be greatly appreciated. Thanks in advance.

Try to enable the Developer tab in ‘Advanced Options’ of XLS Padlock, then in the compiled workbook, go to the VBA editor, add a module and this code to it:

Sub ListerCOMAddInsDansImmediate()
    Dim addIn As COMAddIn
    
    Debug.Print "Nom", vbTab, "Description", vbTab, "ProgID", vbTab, "Connecté"
    
    For Each addIn In Application.COMAddIns
        Debug.Print addIn.Name, vbTab, addIn.Description, vbTab, addIn.ProgID, vbTab, IIf(addIn.Connect, "Oui", "Non")
    Next addIn
    
    Debug.Print vbCrLf & "Liste des COM Add-ins affichée dans la fenêtre Immediate."
End Sub

This should list all COM add-ins available at runtime. The GXLSFormula should be listed too.

Thank you for the suggestions. Here is the code output:

Looks like the GXLS.GXLSPLock addin is connected but the GXLSFormula addin is not. I don’t know if its worth noting but the “addin.Name” threw an error when I was running the code. I changed it to “addIn.Application” to produce the output I’ve linked. I’m running Microsoft Excel for Microsoft 365 version 2410.

Could you please try the new version?

Tried the new version tonight and it still didn’t work. The GXLS.GXLSPLock addin is the only one showing up as connected. Is anyone else having this problem or am I the only one?

Do you have some antivirus or security software that could interfere with Office?

I have the typical Windows Security but that’s it. No other antivirus or security software. I’ve tested disabling the Windows Security Virus & Threat Protection services and re-compiling it. Same result.

I should also mention that I was using a Microsoft Office 2013 version before reaching out on this forum (couple of weeks ago). I thought the the older Microsoft product was creating some issues so I upgraded to test it.

The online activation, online validation, web updates, and code signing services are working as expected (Setup with WooCommerce Int. Kit). I haven’t tested the deactivation yet as I prefer to not show the Welcome dialog (or Load Previous Changes screen) where the deactivation button appears.

Could you please use RegEdit to export the following key?

HKEY_CURRENT_USER\Software\Microsoft\Office\Excel\Addins

Then zip the .REG file and send it to us (or attach it here).

Exported and sent. Thanks!

Could you try to add this sub and run it with Immediate window in the compiled instance?

Sub ActiverCOMAddIn()
    Dim addIn As COMAddIn
    Dim addInName As String
    Dim addInFound As Boolean
    addInFound = False
    
    addInName = "GXLSForm.GXLSFormula"
    
    ' Parcours des COM Add-Ins
    For Each addIn In Application.COMAddIns
        Debug.Print addIn.Name, vbTab, addIn.Description, vbTab, addIn.ProgID, vbTab, IIf(addIn.Connect, "Oui", "Non")
        If addIn.Name = addInName Then
            addInFound = True
            If Not addIn.Connect Then
                addIn.Connect = True
                MsgBox "Le complément '" & addInName & "' a été activé.", vbInformation
            Else
                MsgBox "Le complément '" & addInName & "' est déjà activé.", vbInformation
            End If
            Exit For
        End If
    Next addIn
    
    If Not addInFound Then
        MsgBox "Le complément '" & addInName & "' n'a pas été trouvé.", vbExclamation
    End If
End Sub

I tried it on two separate computers. Here are the results. Note that I swapped AddIn.Name with addIn.ProgID as it was throwing an error.

Computer 1: My computer that I use to generate the .exe files via XLSPadlock
This computer is able to find the “GXLSForm.GXLSFormula” addin, recognizes its not connected, and throws the error when it tries to connect it at the “addIn.Connect = True” line. See error snapshot below:

I tried messing with a bunch of administrator permissions but have not been able to get that line of code to connect the missing addin. I’ll keep trying.

Computer 2: A new computer without XLSPadlock
This computer produced the following intermediate window message. It seems that the addin was not found.

Please first check with your IT team to see if group policies are preventing the activation of the GXLSFormula addin.
Then, please also try to install the Microsoft VC++ Runtimes here:
https://aka.ms/vs/17/release/vc_redist.x86.exe
and
https://aka.ms/vs/17/release/vc_redist.x64.exe

1 Like

Thank you! I had both of the Runtimes installed and repaired them just in case.

I figured out the issue and it ended up being a USER error. I should have tested (or at least posted my settings) near the beginning of this. In an attempt to reduce .exe file size, I was compressing the files with UPX and disabled formula protection via the FAQs recommendations. I’m mainly interested in the licensing features rather than formula protection. The guide has a note saying that selecting this setting will also disable the VBA code compiler. At the time I thought this was an extra setting for more compatibility for Excel 2000. Now it makes sense.

Thank you for all the suggestions and assistance. This problem has be resolved.

1 Like

This makes sense, thank you for the solution!