on 02-15-2024 2:10 PM
Hello! I need to save the generated pdf from SAP. My code is doing everything until this moment - then SAP is "giving back" the role to Windows and I cannot do anything (via VBA) with this window
Can someone help me?
Hello @stefan_schnell ,
I tried on different ways, the problem is with the next step, which is confirm the choice. "%(b)" doesn`t work, but also enter doesn`t work. I tried to put it with ENTER and ~, but it doesn`t react. However, react on tab - I can see it with active buttons on the window, and what is more, it reacts with cancel - then it closes the window. But I am not able to open neither save the file
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" ( _
ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetForegroundWindow Lib "user32" ( _
ByVal hwnd As Long) As Long
Sub test()
Dim hwnd As Long
hwnd = FindWindow(vbNullString, "Descarga de archivos")
SetForegroundWindow hwnd
SendKeys "{tab}"
SendKeys "{tab}"
SendKeys "{tab}"
SendKeys "{ENTER}"
End Sub
Unfortunatelly I don`t know Sleep command
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @aleksandra-0601,
let's try another way. Please look at your SAP GUI options an be sure that the option "Show native Microsoft Windows dialogs" is disabled.
If it is not, disable it and try the download again. Perhaps an SAP GUI for Windows dialog will open that you can automate with SAP GUI Scripting. This would eliminate the need to automate the native Windows dialog via FindWindow and SendKeys.
Let us know your results.
Best regards
Stefan
User | Count |
---|---|
78 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.