‎2008 Jun 13 2:04 PM
Hi all Experts,
I have created a program which tranfers data from different internal tables into Different Worksheets of a single workbook.
Now, Can some one please tell me how to Execute macros from SAP.
Regards,
AJ
‎2008 Jun 16 7:50 PM
To execute an Excel macro follow these steps.
1. Create macro inside Excel Workbook where you transferred your information.
2. Use following instruction to execute the desired macro you create:
DATA: EXCEL TYPE OLE2_OBJECT.
CREATE OBJECT EXCEL 'Excel.Application'.
...
CALL METHOD OF EXCEL 'Run' EXPORTING #1 = 'WRITE_SHEET_CELL'
#2 = 'VALUE1'
#3 = 'VALUE2'
#4 = 'VALUE3'.
In previous example, macro WRITE_SHEET_CELL was created first. The macro name must be in uppercase.
Regards.
Rafael Rojas.
‎2008 Jun 16 7:50 PM
To execute an Excel macro follow these steps.
1. Create macro inside Excel Workbook where you transferred your information.
2. Use following instruction to execute the desired macro you create:
DATA: EXCEL TYPE OLE2_OBJECT.
CREATE OBJECT EXCEL 'Excel.Application'.
...
CALL METHOD OF EXCEL 'Run' EXPORTING #1 = 'WRITE_SHEET_CELL'
#2 = 'VALUE1'
#3 = 'VALUE2'
#4 = 'VALUE3'.
In previous example, macro WRITE_SHEET_CELL was created first. The macro name must be in uppercase.
Regards.
Rafael Rojas.