I have some VBA code that exports SAP data to a .XLSX file, then imports this file into excel. After the file is imported, I have code that performs many other actions (eg p
Today I saw another solution to the problem. I really wanted to share it with you.
for example:
...
' Export from SAP to .xlsx file.
Session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell").contextMenu
Session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell").selectContextMenuItem "&XXL"
Session.findById("wnd[1]/tbar[0]/btn[0]").press
Session.findById("wnd[1]/usr/ctxt[0]").Text = "C:\tmp"
Session.findById("wnd[1]/usr/ctxt[1]").Text = "SAP_export.XLSX"
Session.findById("wnd[1]/tbar[0]/btn[11]").press
Dim xlApp As Object
Application.Wait Now + TimeSerial(0, 0, 5)
Set xlApp = GetObject("c:\tmp\SAP_export.XLSX").Application
xlApp.Workbooks(1).Close False
'xlApp.Quit
...
Regards, ScriptMan