Can't click on Excel VBA MSGBOX dialog controls

Hello!

I am having trouble using the mouse click action on Excel VBA MSGBOX dialog controls.

Very simple Excel worksheet macro:

Private Sub Workbook_Open()
MsgBox “Workbook loaded”
End Sub

Creates a dialog window on loading the worksheet:

Title: Microsoft Excel
Body: Worksheet loaded
Button: [OK]

I used Inspector to identify the MSGBOX window:

[CLASS:#32770;TITLE:Microsoft Excel]

Inspector also identified a control element for the [OK] box:

[CLASS:Button;NAME:OK]

I can use that control reference in a Click Mouse / Window Control action, but it does not work as expected. RPA accepts the control, but instead of clicking the [OK] button on the dialog, it’s clicking somewhere else: the MSGBOX dialog stays open, and I can hear the “bad click” sound from Windows.

I’ve also tried creating another recording, using Insert Recording to create the Click Mouse action. The result is the same: the MSGBOX dialog stays open, and I can hear the “bad click” sound from Windows. RPA is clicking something, but it’s not the MSGBOX [OK] button.

How can I get RPA to click on the MSGBOX [OK] button?

Thanks.

Hi @john_grant do you switch to the MSGBOX dialog window before clicking there?

Yes.

Application / Window:
Window / Mode [*] Select open window
Options / Select a window title from the list [Microsoft Excel - #32770]

@john_grant try recording you clicking on the OK button using the Insert Recording option - it will automatically capture the correct window name.