What I want is to create a procedure but for it to receive n parameters (meaning that it is unknown how many parameters they will create) I have only managed to do it knowing the number of parameters
Sub Actualizar_Ribbon(ByVal boton1 As String, Optional boton2 As String)
UNIVidaTab.InvalidateControl (boton1)
If boton2 <> Empty Then
UNIVidaTab.InvalidateControl (boton2)
End If
End Sub
What I have in mind is something like this. I clarify that I have not figured out yet how to refer to all the parameters and in this example I have 5 parameters but I clarify that what I want is to receive n parameters
Sub Actualizar_Ribbon(ByVal boton1 As String, Optional boton2 As String, Optional boton3 As String, Optional boton4 As String, Optional boton5 As String)
Dim i As Integer
For i = 1 To 5
If boton & i <> Empty Then
UNIVidaTab.InvalidateControl (boton & i)
Exit For
End If
Next i
End Sub
I would really appreciate it if you can help me
You can declare a variable array of parameters using
ParamArray
, an example:The exit:
Being an array of objects
Variant
you can, with care, pass all kinds of values. Your routine could finally look like this: