Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3132

Re: VBA Code to export data from SAP and save to Desktop

$
0
0

Hello Michael,

 

in my case your code works perfect, here my example code:

 

If Not IsObject(application) Then

   Set SapGuiAuto = GetObject("SAPGUI")

   Set application = SapGuiAuto.GetScriptingEngine

End If

 

If Not IsObject(Connection) Then

   Set Connection = application.Children(0)

End If

 

If Not IsObject(session) Then

   Set session = Connection.Children(0)

End If

 

session.findById("wnd[0]/tbar[0]/btn[86]").press

session.findById("wnd[1]/usr/ctxtPRI_PARAMS-PDEST").Text = "LOCL"

session.findById("wnd[1]/usr/cmbPRIPAR_EXT-OSPRINTER").Key = "Adobe PDF"

session.findById("wnd[1]/tbar[0]/btn[13]").press

 

Set Wshell = CreateObject("WScript.Shell")

WScript.Sleep 10000

 

Do

  WScript.Sleep 100

  bWindowFound = Wshell.AppActivate("PDF-Datei speichern unter")

Loop Until bWindowFound

Wshell.SendKeys ("Parked and Blocked Report" & " " & FormatDateTime(Date, vbShortDate) & ".pdf")

WScript.Sleep 100

Wshell.SendKeys ("{ENTER}")

WScript.Sleep 100

 

It works with and without open print daemon window, it seems that this makes no difference.

 

Don't be hopeless, together we will find a solution.

 

Cheers

Stefan


Viewing all articles
Browse latest Browse all 3132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>