Excel – “Clicking” Command Button from other workbook

excelvba

I am trying to write a macro that would "click" a command button that is in another workbook. Is that possible? Without changing any of the code within that other workbook?

Best Solution

For an ActiveX button in another workbook:

Workbooks("OtherBook").Worksheets("Sheet1").CommandButton1.Value = True

For an MSForms button in another workbook:

Application.Run Workbooks("OtherBook").Worksheets("Sheet1").Shapes("Button 1").OnAction
Related Question