Control handle in SAP with VBA

amarokWPcom

New Member
Joined
May 30, 2019
Messages
25
In our SAP system, we have a mass attack tool.

There is one point at which my VBA cannot control the SAPgui anymore, it's when the "Select Files:" window appears (see screenshot).

Yesterday I got a solution on how to find this window from a good man here in the Forum. The macro gave me all the open windows running, but now I have to find how to start with this.

Does anyone have more knowledge about stuff like this???

The output with the mentioned window is in the second screenshot.

2020-01-30_06-35-41.png



2020-01-30_06-35-25.png
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
I found the filed in which i want to put a text.
The main window is this:
266612​
#32770Select Files:

And the file to put the filename is this:

266578​
ComboBoxEx32
 
Upvote 0
It is working like that:
VBA Code:
Sub controlstuff()
hwnd = FindWindow(vbNullString, "Select Files:")

Do
DoEvents
hwindow2 = FindWindow(vbNullString, "Select Files:")

Loop Until hwindow2 > 0

file_name_box = FindWindowEx(hwindow2, 0&, "ComboBoxEx32", vbNullString)
ok_button = FindWindowEx(hwindow2, 0&, "Button", "Ö&ffnen")

file_name = Worksheets("Sheet1").Range("B210")


Call SendMessageByString(file_name_box, WM_SETTEXT, 0, file_name)
Call SendMessage(ok_button, BM_CLICK, 0, ByVal 0&)

End Sub
 
Upvote 0

Forum statistics

Threads
1,216,174
Messages
6,129,296
Members
449,498
Latest member
Lee_ray

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