I have several button with names that have the same name as elements in AF system explorer. Im trying to make each button call the same function . So for example i have a Button called Room_A , on click it calls a function called TestButtonToggle_Click(). In this function i would like to pass in the button name which would return a value from AF with an element of the same name.
How would i go about doing this?
What i have tried below;
Public Sub TestButtonToggle_Click(ByVal lvarX As Long, ByVal lvarY As Long)
Dim pbButtons As SelectedButton
Dim pbButton As Button
Dim Cell As String
Set pbButtons = ThisDisplay.SelectedButtons
If pbButtons.Count = 0 Then
For Each pbButton In pbButtons
If InStr(buttonName.name, "Room") Then
Room = Mid(buttonName.name, 6, Len(buttonName.name))
'Pass number to function below