Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Execute macro in a program

Former Member
0 Kudos

How to execute a macro of excel from a report?

1 REPLY 1

Former Member
0 Kudos

using the FM SAP_CONVERT_TO_XLS_FORMAT.

to run the macro:

CREATE OBJECT h_excel 'EXCEL.APPLICATION'.

call method of h_excel 'WORKBOOKS' = h_mapl.

set property of h_excel 'VISIBLE' = 0.

call method of h_mapl 'OPEN'

EXPORTING

#1 = d_file.

CALL METHOD OF H_EXCEL 'ActiveWorkbook' = h_book .

CALL METHOD OF H_book 'Activesheet' = H_sheet .

CALL METHOD OF h_excel 'RUN'

EXPORTING

#1 = ld_macro.