Skip to Content
Former Member
Mar 23, 2016 at 01:11 PM

VBA code to save pdf generated document from SAP using 'CutePDF writer'


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...


PrintPreview.jpg (45.8 kB)
Print.jpg (55.5 kB)
SaveAs.jpg (71.4 kB)