I create a script in VBA to save pdf´s but the script can´t catch the file name that I put in. my script finish like this:
but I need to change the file name in the next popup
Is possible to do it with script?
On
please review the below article, I had a similar issue to yours and I found this article to be helpful. The last section "Show native Microsoft Windows dialogs – OFF" shows what the correct output should look like. https://simpleexcelvba.com/native-microsoft-windows-dialogs-in-sap/
In SAP, begin by going to Options > Accessibility & Scripting > Scripting > Uncheck "Show native Microsoft Windows dialogs"
SAP GUI Options - Scripting Settings
You will most likely need to re-record the SAP script that exports your PDF, because instead of the windows dialog that is shown in the picture of your original post, the below screen will appear:
SAP dialog box for exported file Path & Name
Now, when you re-record your SAP script, the file path and name entered into the SAP GUI export window will be recorded in your script, and the code will look somewhat similar to the highlighted section of the code in the below picture (in mine, the commented-out code is being used as a method to dynamically name each file from a pre-defined array to respectively name multiple different exports based on the data being exported while looping through the array):
You can use pre-defined variables, i.e., a constant such as "My PDF" & " " & Date & ".PDF" in order to rename the file.
I hope this helps.
One possibility is to deactivate the option "Show native Microsoft Windows dialogs" on the computer where SAP GUI for Windows runs, and a SAP GUI popup to select the target file will be displayed that you can easily script with SAP GUI Scripting (as you currently do, i.e. as with any native SAP GUI screen):
If needed, you may also change the Windows Registry value corresponding to this option. Excerpt from the SAP GUI 8.00 Administration Guide:
[HKEY_CURRENT_USER\Software\SAP\SAPGUI Front\SAP Frontend Server\Scripting]NB: this answer is language-agnostic (not specific to VBA)