<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: VBA code to save pdf generated document from SAP using 'CutePDF writer' in Additional Q&amp;A</title>
    <link>https://community.sap.com/t5/additional-q-a/vba-code-to-save-pdf-generated-document-from-sap-using-cutepdf-writer/qaa-p/11552251#M148594</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sagar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I handle these by a VBScript. Write &amp;amp; save these in notepad and launch them through Shell from VBA right before VBA gets stuck.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. The script finds the screen based on the "Save As" text.&lt;/P&gt;&lt;P&gt;2. Enter the full directory in the File name text field&lt;/P&gt;&lt;P&gt;3. Click Save&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following code handles another popup, but it does something very similar.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;Set Wshell = CreateObject("WScript.Shell")&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;do&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; bWindowFound = Wshell.AppActivate("SAP GUI Security")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Sleep 1000&lt;/P&gt;
&lt;P&gt;loop Until bWindowFound&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;bWindowFound = Wshell.AppActivate("SAP GUI Security")&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;if (bWindowFound) then&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Wshell.Sendkeys "{TAB}"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Wshell.Sendkeys "{TAB}"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Wshell.Sendkeys "{ENTER}"&lt;/P&gt;
&lt;P&gt;end if&lt;/P&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Jun 2016 13:48:13 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2016-06-01T13:48:13Z</dc:date>
    <item>
      <title>VBA code to save pdf generated document from SAP using 'CutePDF writer'</title>
      <link>https://community.sap.com/t5/additional-q-a/vba-code-to-save-pdf-generated-document-from-sap-using-cutepdf-writer/qaq-p/11552250</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm currently writing a code to automate process of -&lt;BR /&gt;1. Uploading data from excel to SAP&lt;/P&gt;&lt;P&gt;2. Generate and save excel file (report) on specific folder, like desktop&lt;/P&gt;&lt;P&gt;3. Generate PDF report and save to specific folder.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using script recorder and many useful contents given on this forum, I some how able to complete point 1 &amp;amp; 2. I stuck at point 3, where I'm able to generate PDF document but not able to save it on the desktop.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="text-decoration: underline;"&gt;Below is my challange:-&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Once the PDF (PrintPreview) document is generated, I need to select 'Print' button to select 'CutePDF writer' and press 'OK'.&lt;BR /&gt;Then the Save As window pop-up in which I need to enter path to save this pdf file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below are the snap-shot of screen your reference (these pop-up in these sequence).&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/jiveimages/914490" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/jiveimages/914491" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/jiveimages/914504" width="450" /&gt;&lt;/P&gt;&lt;P&gt;session.findById("wnd[0]/tbar[1]/btn[8]").press&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' &amp;lt;= This line generate PDF document (PrintPreview)&lt;/P&gt;&lt;P&gt;session.findById("wnd[0]/mbar/menu[0]/menu[0]").Select&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' &amp;lt;= after this line Print window open in which I need to select "CutePDF Writer"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can some one help, how to access last two windows and select options / data I required.&lt;BR /&gt;Any help is much appriciated...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Mar 2016 13:11:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/vba-code-to-save-pdf-generated-document-from-sap-using-cutepdf-writer/qaq-p/11552250</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-03-23T13:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: VBA code to save pdf generated document from SAP using 'CutePDF writer'</title>
      <link>https://community.sap.com/t5/additional-q-a/vba-code-to-save-pdf-generated-document-from-sap-using-cutepdf-writer/qaa-p/11552251#M148594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sagar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I handle these by a VBScript. Write &amp;amp; save these in notepad and launch them through Shell from VBA right before VBA gets stuck.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. The script finds the screen based on the "Save As" text.&lt;/P&gt;&lt;P&gt;2. Enter the full directory in the File name text field&lt;/P&gt;&lt;P&gt;3. Click Save&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following code handles another popup, but it does something very similar.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;Set Wshell = CreateObject("WScript.Shell")&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;do&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; bWindowFound = Wshell.AppActivate("SAP GUI Security")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Sleep 1000&lt;/P&gt;
&lt;P&gt;loop Until bWindowFound&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;bWindowFound = Wshell.AppActivate("SAP GUI Security")&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;if (bWindowFound) then&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Wshell.Sendkeys "{TAB}"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Wshell.Sendkeys "{TAB}"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Wshell.Sendkeys "{ENTER}"&lt;/P&gt;
&lt;P&gt;end if&lt;/P&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jun 2016 13:48:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/vba-code-to-save-pdf-generated-document-from-sap-using-cutepdf-writer/qaa-p/11552251#M148594</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-06-01T13:48:13Z</dc:date>
    </item>
  </channel>
</rss>

