Click Ok in Message Box pop-up Excel VBA

Mbresso

New Member
Joined
Jun 13, 2022
Messages
1
Office Version
  1. 2013
Platform
  1. Windows
Hi all,
I need some support, since I've created a Macro for Log-in into SAP and pull automatically some reports.
But when I'm running it, an SAP Message box pop-ups "A script is attempting to access SAP GUI" (Two Buttons: "Ok" and "Cancel") and then, after manually clic in "Ok", another message box pop-ups with "A Script is opening a connection to System: XXX" (Two BUttons: "Ok" and "Cancel").

Is there a way, in which I can Include some coding into the original Script, for advancing in those "OK" Clics so I could have the process fully automated without any manual interaction?

Thanks in advance for your guidance.

Regards

Mario
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
You could try with Application.SendKeys to send keystrokes to the active window; for example you could wait to be sure the first popup has popped-up, then send "Enter" (if Ok is already selected by default; or first send a Tab then Enter); then repeate the process for the second popup

For details about SendKeys: Application.SendKeys method (Excel)

Always insert "enough" delay from one command to the next, using either Application.Wait (example Application.Wait (Now + TimeValue("0:00:02"))) or Sleep (requires declaring the function Sub Sleep Lib "kernel32"), that has much more flexibility.

Bye
 
Upvote 0

Forum statistics

Threads
1,216,102
Messages
6,128,847
Members
449,471
Latest member
lachbee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top