Skip to Content

Excel Macro with parameters calling from ABAP

Hello experts,

I need to call an Excel Macro from ABAP, I am using i_oi_document_proxy->execute_macro, but when I execute I dont know how to 'accept' the parameters in my Macro, and to make it even harder for example when I declare parameters in my Macro as below:

Public Sub Macro3(v_start as String, v_end as String)

'

' Macro3 Macro

'

'

Range("A1:A29").Select

Selection.Rows.Group

End Sub

The Excel won't recognize my Macro and SAP won't call it

I hope I was clear,

Regards,

Dren

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Oct 23, 2015 at 03:42 PM

    in the method, I can see the some parameters to pass it to macro? Did you try them already??

    Also check this links. May be useful.


    Capture.PNG (48.7 kB)
    Add comment
    10|10000 characters needed characters exceeded

  • Oct 26, 2015 at 09:31 AM

    Hi.

    Probably you're calling your Sub in an incorrect way. You must refear always your MainModule in the "name sub parameter".

    If you declare a Sub like this

    You should not find any problems calling from SAP in this way

    CALL METHOD gr_proxy->EXECUTE_MACRO

    EXPORTING

    MACRO_STRING = 'MainModule.HideSheet'

    PARAM1 = loc_sheetname

    PARAM_COUNT = 1

    IMPORTING

    ERROR = gr_error

    RETCODE = gwf_retcode.


    Hope to help


    Bye


    Add comment
    10|10000 characters needed characters exceeded