Skip to Content
avatar image
Former Member

Attaching VBA macro to open workbook in Customize user interface for Analysis (AO) 2.6

Here, I want to customize user interface in analysis for office 2.6 SP 2. I am adding a group named "Budgeting" , and sub element as "open workbook" with a macro attached in split button which will show list of workbooks and user can click to open.

I am referring to the below mentioned code and youtube video:

https://www.youtube.com/watch?v=X1jXGF8NiFs

Example :
Sub OpenWorkbookViaAPI()

Dim lresult As Long

lresult = Application.Run("SAPOpenWorkbook", "DEMO_5", "DS_1", "ZCOUNTRY_VAR_02", "AT", "0I_FPER", "001.2011 - 004.2011")

End Sub

----------

Please revert ASAP
Thanks in advance for your help ! :)

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Mar 28 at 10:23 AM

    And where is the question????

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 28 at 12:30 PM

    The steps that I am following to create a customize profile in AO 2.6:
    1. Click on option customize user interface.

    2. Click on New group option and provide a label name(BUDGETING) for that new group.

    3. Click on New sub element and provide the option for element(SPLIT BUTTON), enter the name for label (OPEN DOCUMENTS) and attach the file name of macro

    The below mentioned Macro I used.:
    Sub OpenWorkbookViaAPI()

    Dim lresult As Long

    lresult = Application.Run("SAPOpenWorkbook", "INP_VSC_CPX_PLN", "DS_1")

    End Sub

    4. After saving it and restarting the excel, the new tab which I created by the name of Budgeting is empty. There should be the documents listed as per the macro.


    PFA images
    This is my standard ribbon.

    This is the snapshot taken from Video where similarly I am entering the macro name.



    This tab is what I am expecting in my scenario but it is empty.



    Add comment
    10|10000 characters needed characters exceeded

  • Jul 17 at 12:21 PM

    Hello,

    you need to add "(control as IRibbonControl)" behind your macro name.

    Example:

    Sub OpenWorkbookViaAPI(control as IRibbonControl)

    Dim lresult As Long

    lresult = Application.Run("SAPOpenWorkbook", "DEMO_5", "DS_1", "ZCOUNTRY_VAR_02", "AT", "0I_FPER", "001.2011 - 004.2011")

    End Sub

    Go to SAP Help Analysis-Plugin User-Guide chapter "How do you customize a tab in the Ribbon?"

    Best regards

    Christopher

    Add comment
    10|10000 characters needed characters exceeded