|
違う方法だけど..。
クラスモジュール(名前は、Class1)
Public WithEvents ButtonClickEvent As MSForms.CommandButton
Private Sub ButtonClickEvent_Click()
With ButtonClickEvent
引数 = UserForm1.ActiveControl.Caption
Application.Run "ボタン135", 引数
End With
End Sub
フォームモジュール
Dim FMCls() As New Class1
Private Sub UserForm_Initialize()
Dim FMCNT As Long
FMCNT = 0
For Each Form_C In Me.Controls
If TypeName(Form_C) = "CommandButton" Then
FMCNT = FMCNT + 1
ReDim Preserve FMCls(1 To FMCNT)
Set FMCls(FMCNT).ButtonClickEvent = Me.Controls(Form_C.Name)
End If
Next
End Sub
標準モジュール
Sub ボタン135(hikisuu)
MsgBox hikisuu
End Sub
|
|