05/03/24 12:30:08
>>393です。
みなさんありがとうございます。
結果、下記のようになりました。
Private Function GetButton(ByVal a_str As String) As Button
Dim objControl As Control
Dim btn As Button
Dim strWork As String
For Each objControl In Me.Controls
If objControl.GetType Is GetType(Button) Then
btn = CType(objControl, Button)
strWork = btn.Name
If strWork = a_str Then
GetButton = objControl
Exit For
End If
End If
Next
End Function