Hi could someone help with a VBA which automatically runs a VBS sap script from excel?
i'd like to print the reservations already made.In this case, i have to mark each file that i want to print, manually.So, how do i tell the program that i want to print only the 5 or 10 last reservations made.
Thanks!
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; white-space: inherit;">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
If IsObject(WScript) Then
End If
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").text = "/nzmb25"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtWERKS-LOW").text =
session.findById("wnd[0]/usr/ctxtBDTER-LOW").text =
session.findById("wnd[0]/usr/txtUSNAM-LOW").text =
session.findById("wnd[0]/usr/txtUSNAM-LOW").setFocus
session.findById("wnd[0]/usr/txtUSNAM-LOW").caretPosition = 5
session.findById("wnd[0]/tbar[1]/btn[8]").press
session.findById("wnd[0]/usr/chk[1,38]").selected = true
session.findById("wnd[0]/usr/chk[1,38]").setFocus
session.findById("wnd[0]/tbar[1]/btn[20]").press
session.findById("wnd[0]/tbar[1]/btn[19]").press
session.findById("wnd[1]/usr/chkITCPP-TDDELETE").selected = true
session.findById("wnd[1]/usr/chkITCPP-TDIMMED").selected = true
session.findById("wnd[1]/usr/chkITCPP-TDIMMED").setFocus
session.findById("wnd[0]/usr/chk[1,37]").selected = true
session.findById("wnd[0]/usr/chk[1,37]").setFocus
session.findById("wnd[0]/tbar[1]/btn[19]").press
session.findById("wnd[1]/usr/chkITCPP-TDIMMED").selected = true
session.findById("wnd[1]/usr/chkITCPP-TDDELETE").selected = true
session.findById("wnd[1]/usr/chkITCPP-TDDELETE").setFocus
session.findById("wnd[0]/usr/chk[1,36]").selected = true
session.findById("wnd[0]/usr/chk[1,36]").setFocus
session.findById("wnd[0]/tbar[1]/btn[19]").press
session.findById("wnd[1]/usr/chkITCPP-TDIMMED").selected = true
session.findById("wnd[1]/usr/chkITCPP-TDDELETE").selected = true
session.findById("wnd[1]/usr/chkITCPP-TDDELETE").setFocus</code>
i'd like to print the reservations already made.In this case, i have to mark each file that i want to print, manually.So, how do i tell the program that i want to print only the 5 or 10 last reservations made.
Thanks!
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; white-space: inherit;">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
If IsObject(WScript) Then
End If
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").text = "/nzmb25"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtWERKS-LOW").text =
session.findById("wnd[0]/usr/ctxtBDTER-LOW").text =
session.findById("wnd[0]/usr/txtUSNAM-LOW").text =
session.findById("wnd[0]/usr/txtUSNAM-LOW").setFocus
session.findById("wnd[0]/usr/txtUSNAM-LOW").caretPosition = 5
session.findById("wnd[0]/tbar[1]/btn[8]").press
session.findById("wnd[0]/usr/chk[1,38]").selected = true
session.findById("wnd[0]/usr/chk[1,38]").setFocus
session.findById("wnd[0]/tbar[1]/btn[20]").press
session.findById("wnd[0]/tbar[1]/btn[19]").press
session.findById("wnd[1]/usr/chkITCPP-TDDELETE").selected = true
session.findById("wnd[1]/usr/chkITCPP-TDIMMED").selected = true
session.findById("wnd[1]/usr/chkITCPP-TDIMMED").setFocus
session.findById("wnd[0]/usr/chk[1,37]").selected = true
session.findById("wnd[0]/usr/chk[1,37]").setFocus
session.findById("wnd[0]/tbar[1]/btn[19]").press
session.findById("wnd[1]/usr/chkITCPP-TDIMMED").selected = true
session.findById("wnd[1]/usr/chkITCPP-TDDELETE").selected = true
session.findById("wnd[1]/usr/chkITCPP-TDDELETE").setFocus
session.findById("wnd[0]/usr/chk[1,36]").selected = true
session.findById("wnd[0]/usr/chk[1,36]").setFocus
session.findById("wnd[0]/tbar[1]/btn[19]").press
session.findById("wnd[1]/usr/chkITCPP-TDIMMED").selected = true
session.findById("wnd[1]/usr/chkITCPP-TDDELETE").selected = true
session.findById("wnd[1]/usr/chkITCPP-TDDELETE").setFocus</code>