on 03-23-2016 1:11 PM
Dear Community,
I'm currently writing a code to automate process of -
1. Uploading data from excel to SAP
2. Generate and save excel file (report) on specific folder, like desktop
3. Generate PDF report and save to specific folder.
Using script recorder and many useful contents given on this forum, I some how able to complete point 1 & 2. I stuck at point 3, where I'm able to generate PDF document but not able to save it on the desktop.
Below is my challange:-
Once the PDF (PrintPreview) document is generated, I need to select 'Print' button to select 'CutePDF writer' and press 'OK'.
Then the Save As window pop-up in which I need to enter path to save this pdf file.
Below are the snap-shot of screen your reference (these pop-up in these sequence).
session.findById("wnd[0]/tbar[1]/btn[8]").press ' <= This line generate PDF document (PrintPreview)
session.findById("wnd[0]/mbar/menu[0]/menu[0]").Select ' <= after this line Print window open in which I need to select "CutePDF Writer"
Can some one help, how to access last two windows and select options / data I required.
Any help is much appriciated...
Hi Sagar,
I handle these by a VBScript. Write & save these in notepad and launch them through Shell from VBA right before VBA gets stuck.
1. The script finds the screen based on the "Save As" text.
2. Enter the full directory in the File name text field
3. Click Save
The following code handles another popup, but it does something very similar.
Set Wshell = CreateObject("WScript.Shell")
do
bWindowFound = Wshell.AppActivate("SAP GUI Security")
WScript.Sleep 1000
loop Until bWindowFound
bWindowFound = Wshell.AppActivate("SAP GUI Security")
if (bWindowFound) then
Wshell.Sendkeys "{TAB}"
Wshell.Sendkeys "{TAB}"
Wshell.Sendkeys "{ENTER}"
end if
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.