Ga naar inhoud

Arrays doorgeven aan gecompileerde VBA-code

U kunt verschillende variabeletypen doorgeven aan de gecompileerde VBA-code, waaronder statische arrays.

Stel dat u de volgende functie in de VBA Compiler hebt:

Function TestMultipleParams(Param1, Param2, Param3)
MsgBox(Param2(1))
TestMultipleParams = Param3 ^ 2
End Function

In uw normale Excel-VBA-module kunt u deze functie aanroepen en een array doorgeven.

Sub MySubSample4()
Dim XLSPadlock As Object
Set XLSPadlock = Application.COMAddIns("GXLSForm.GXLSFormula").Object
Dim NomTableau(2) As Variant
NomTableau(0) = "a"
NomTableau(1) = "b"
NomTableau(2) = "c"
MsgBox XLSPadlock.PLEvalVBA3("TestMultipleParams", "Param1", NomTableau, 3)
Set XLSPadlock = Nothing
End Sub