How do I include XLL add-ins and register them?



It is possible to register add-ins in XLL format by listing them as companion files to your workbook.

To do this, you need to have 2 versions of your add-in: 32-bit and 64-bit formats. The filename’s extensions must be modified as shown on the screenshot below, so that XLS Padlock registers the correct version with Excel at runtime:

Then, to load the add-in in your workbook, you can use the following VBA code:

Public Function PathToCompiledFile(Filename As String)

Dim XLSPadlock As Object

On Error GoTo Err

Set XLSPadlock = Application.COMAddIns("GXLSForm.GXLSFormula").Object

PathToCompiledFile = XLSPadlock.PLEvalVar("XLSPath") & Filename

Exit Function


PathToCompiledFile = ""

End Function


Private Sub Workbook_Open()

    Dim success As Boolean 

    ' Load XLL

    success = Application.RegisterXLL(PathToCompiledFile("sample.xll"))

End Sub 


Copyright © 2023 G.D.G. Software