Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Script recording and playback: copy data from exel in place to clipboard

bensh-1
Member
0 Kudos

I'm currently working on a script with the script recorder and playback.

It works verry well until the script opens up the data in "exel in place".

I want to copy the dat in that exel to my pc clipboard and this doesn't always works.

In the script comming out of the recording there is no vbs program line that dictates the exel in place data to be copied.

Does anybody know how to automatic copy and past that data to clibboard

This is the code so far. This code gets orders out of sap copied to a exel that are limited by date, workplace and id of the installatie.

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
WScript.ConnectObject session, "on"
WScript.ConnectObject application, "on"
End If
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").text = "/N/ARMP/CP_GK"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/cntlMAIN_CONTAINER/shellcont/shell/shellcont[0]/shell").selectedNode = "GATEKP_1820"
session.findById("wnd[0]/usr/cntlMAIN_CONTAINER/shellcont/shell/shellcont[0]/shell").topNode = "GATEKP_1203"
session.findById("wnd[0]/usr/cntlMAIN_CONTAINER/shellcont/shell/shellcont[0]/shell").doubleClickNode "GATEKP_1820"
session.findById("wnd[0]/usr/ctxtS_SCHED-LOW").text = "18032019"
session.findById("wnd[0]/usr/ctxtS_SCHED-HIGH").text = "18032019"
session.findById("wnd[0]/usr/tabsTABSTRIP_PMPS_002/tabpTAB_PM/ssub%_SUBSCREEN_PMPS_002:/PGPNL/GPSS_PM:0212/ctxtS_GEWRK-LOW").text = "R*"
session.findById("wnd[0]/usr/tabsTABSTRIP_PMPS_002/tabpTAB_PM/ssub%_SUBSCREEN_PMPS_002:/PGPNL/GPSS_PM:0212/ctxtS_GEWRK-LOW").setFocus
session.findById("wnd[0]/usr/tabsTABSTRIP_PMPS_002/tabpTAB_PM/ssub%_SUBSCREEN_PMPS_002:/PGPNL/GPSS_PM:0212/ctxtS_GEWRK-LOW").caretPosition = 2
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/tabsTABSTRIP_PMPS_002/tabpTAB_PM/ssub%_SUBSCREEN_PMPS_002:/PGPNL/GPSS_PM:0212/ctxtSTRNO-LOW").text = "GT-RP-COM1-CR-31*"
session.findById("wnd[0]/usr/tabsTABSTRIP_PMPS_002/tabpTAB_PM/ssub%_SUBSCREEN_PMPS_002:/PGPNL/GPSS_PM:0212/ctxtSTRNO-LOW").setFocus
session.findById("wnd[0]/usr/tabsTABSTRIP_PMPS_002/tabpTAB_PM/ssub%_SUBSCREEN_PMPS_002:/PGPNL/GPSS_PM:0212/ctxtSTRNO-LOW").caretPosition = 17
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[1]/btn[8]").press
session.findById("wnd[0]/shellcont[1]/shell").setCurrentCell -1,""
session.findById("wnd[0]/shellcont[1]/shell").selectAll
session.findById("wnd[0]/shellcont[0]/shellcont/shell").pressButton "CAPPLAN"
session.findById("wnd[0]/shellcont/shell").pressToolbarContextButton "&MB_VIEW"
session.findById("wnd[0]/shellcont/shell").selectContextMenuItem "&VEXCEL"
' session.findById("wnd[0]/shellcont/shell[1]").setDocument 1,""
session.findById("wnd[0]/shellcont/shell[0]").pressToolbarContextButton "&MB_VIEW"
' session.findById("wnd[0]/shellcont/shell[1]").setDocument 1,""
session.findById("wnd[0]/shellcont/shell[0]").pressToolbarContextButton "&MB_EXPORT"
' session.findById("wnd[0]/shellcont/shell[1]").setDocument 1,""
session.findById("wnd[0]/shellcont/shell[0]").pressToolbarContextButton "&MB_VARIANT"
' session.findById("wnd[0]/shellcont/shell[1]").setDocument 1,""
session.findById("wnd[0]/tbar[0]/btn[12]").press
session.findById("wnd[0]/tbar[0]/btn[12]").press
session.findById("wnd[0]/tbar[0]/btn[12]").press
session.findById("wnd[0]/tbar[0]/btn[12]").press

0 REPLIES 0