Skip to Content
Former Member
Apr 13, 2016 at 11:18 AM

Help required to activate saved workbook from SAP while VBA script is running


Dear Community

I'm doing a project in which I need to download excel report from SAP 7.3 and from the downloaded workbook I need to prepare summary report using different calculations. There are more than 200+ items which I need to download and prepare summary reports, guess need to loop through this task.

When I manually saved one excel report it get automatically open and became my active screen, hence I thought its better to do work on my summary task as soon as I saved the report but its not working. I use normal activate workbook option, but it did not locate the workbook. When I manually stop the code then the workbook get open. any Idea why is this happening..... Has anyone worked on same situation before?

Below is my code:

session.findById("wnd[0]").sendVKey 8 'on this line the SaveAs window pop-up

FilePath = "c:\tmp\Sap download file\ExcelReport1.xlsx") 'I run another vb script to locate the saveAs window and enter path and save it

set Wshell = CreateObject("WScript.Shell") """c:\tmp\save_as.vbs """ & FilePath

Application.wait Now + TimeValue("0:00:05")