Skip to Content
Author's profile photo Dirk Mayrock

VBA: Create embedded help for writing Analysis Office VBA commands – PART 1

Hi Analysis Office VBA programmers,
are your tired of looking up Analysis Office VBA command syntax in the documentation?
are you jealous of the great context sensitive help in SAP BusinessObjects Design Studio while writing code there?
If you answer at least one of those questions with yes it will be worth reading that blog.
In this first part of my series I will explain how to get a generic syntax help while coding analysis specific vba like that…
list of available commands
list of available parameters for a command
To get this help you need to follow these steps:
  1. Go to the VBA editor and create a new Module.
  2. Paste in the following code which can be used as example implementation
    Public Function SAP_SetFilter(iDataSource As String, iDimension As String, iMember As String, iMemberFormat As String) As Integer
        SAP_SetFilter = Application.Run("SAPSetFilter", iDataSource, iDimension, iMember, iMemberFormat)
    End Function
    Public Function SAP_AddMessage(iText As String, Optional iSeverity As String = "INFORMATION", Optional iDetails As String = "") As Integer
        SAP_AddMessage = Application.Run("SAPAddMessage", iText, iSeverity, iDetails)
    End Function
  3. Export your Module to a .bas file
When you do your next VBA project simply import your .bas file in the vba editor and as soon as you write your vba code you can see the help available like on the screens above.
In the next part of that blog I will explain how to enrich that with more details like the available filter setting for the SAPSetFilter command like on the screen below.
Hope you enjoy…
* I added a TXT as Example. There are all APIs included except SAPExecuteCommand. I will think about how to best implement it. You can download it and than change file extension to  .bas
* See the second part, its available now

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi Dirk,

      thanks for sharing, waiting for the second part.


      Author's profile photo Ofer Inbar
      Ofer Inbar

      Hi Kirk,

      is it possible to embed a VBA code in an excel file to activate the Analysis add-in before the report is opened?

      I know that you can control the behavior of the add-in via the registry, but that just opens the add-in every time the user uses excel.

      I tried something like this, but no luck:

      Private Sub Workbook_Open()

      AddIns("Analysis").Installed = True

      End Sub