Entering content frameSyntax documentation execute_macro Locate the document in its SAP Library structure

You use this method to execute a macro in the office application

CALL METHOD document->execute_macro
     EXPORTING macro_string  = macro_string
               param_count   = param_count
               script_name   = script_name
               param1        = param1
               param2        = param2
               param3        = param3
               param4        = param4
               param5        = param5
               param6        = param6
               param7        = param7
               param8        = param8
               param9        = param9
               param10       = param10
               param11       = param11
               param12       = param12
               no_flush      = no_flush
     IMPORTING error         = error
               retcode       = retcode
     CHANGING  error_string  = error_string
               retvalue      = retvalue.

Description of parameters

Parameter

Optional

Description

macro_string

 

The name of the macro in the office application

script_name

X

' ': The macro is part of the document

<name>: The macro is placed in the script collection under this name.

param_count

X

Number of parameters to be passed to the macro

param1.. param9

X

The parameters to be passed to the macro (not Word 97)

error_string

X

The internal error code from the application macro is returned to the ABAP side, and can be handled there. This suppresses the normal VB dialog box.

retvalue

X

Value generated by the application macro.

Note

If you are using Word, you cannot pass any parameters to the macro.

You can also specify the name of a template, add-in, or VBA module in the form ‘template_name.macro_name’ or ‘module_name.macro_name’.

Leaving content frame