0

I have to create a macro that runs a SAP transaction, enters some particular data and generates a report, and exports that report to Excel spreadsheet. This generates an Excel file named as export.xlsx.

But I am not able to access the data of this spreadsheet unless I manually save that Excel sheet at a certain location, then open that Excel sheet and retrieve its data.

I want the VBA code to directly refer to that spreadsheet as it is automatically generated from SAP when the command "Export to Excel spreadsheet" is selected.

I have been able to code the VBA code that generates the report and select the command "Export to Excel spreadsheet".

Can anyone guide me from this point?

It will be really helpful.

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
parag
  • 3
  • 1
  • 2
  • 1
    The standard Export feature always generates the file and opens it. There's no other solution than waiting for Excel to open the file, then run your custom code to process the Excel file. – Sandra Rossi Jun 08 '20 at 20:03
  • Does this answer your question? [How to access SAP using Excel VBA?](https://stackoverflow.com/questions/47143866/how-to-access-sap-using-excel-vba) – Suncatcher Jun 09 '20 at 07:37
  • You can create SAP object inside Excel without using GUI scripting like above or use one of these approaches: [0](https://stackoverflow.com/questions/35118767/excel-vba-pulling-data-from-sap-netweaver), [1](https://stackoverflow.com/a/45499658/911419), [2](https://stackoverflow.com/a/55476236/911419), [3](https://stackoverflow.com/a/58348742/911419), [4](https://stackoverflow.com/questions/24297063/pulling-data-from-sap-using-excel-macros). Please, search thoroughly before posting such basic questions – Suncatcher Jun 09 '20 at 07:41

0 Answers0