'ブックB
Sub Sample()
Dim p As String
Dim wb As Object
p = "C:\Users\user\Desktop\A.xlsm"
Set wb = Workbooks.Open(p)
wb.VBProject.VBComponents("UserForm1").Designer.Controls("textbox1").Value = "テスト"
MsgBox wb.VBProject.VBComponents("UserForm1").Designer.Controls("CommandButton1").Caption
Application.Run "A.xlsm!フォームを開く"
Application.Run "A.xlsm!コマンドボタンクリック"
End Sub
'-----------------------------------------------------------
'ブックA
Sub コマンドボタンクリック()
Call UserFormA.CommandButton1_Click
End Sub
Sub CommandButton1_Click()
MsgBox "メッセージ"
End Sub
More than 3 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
List of users who liked
00