Help required to activate saved workbook from SAP while VBA script is running
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").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")
wshell.run """c:\tmp\save_as.vbs """ & FilePath
Application.wait Now + TimeValue("0:00:05")
Script Man replied
You're right. But this is sometimes like that. A VB script responds simply different than a manual input. If the Excel workbook was created and the "Save As" window is closed, you can open file with the following command itself:
Workbooks.Open Filename:= ExcelPath