Skip to Content
0
Former Member
Apr 18, 2005 at 06:14 PM

VBA Code to expand a Hierachry

56 Views

I have a workbook in BW (3.0), and am trying to do some formatting to the results area. I want to create a macro to expand the hierarchy after getting the results of the query. I found the following code in BW Expert Online, but I an getting an error on the underlined part of the code. I am a novice at BW, and my only exposure to VBA has been in the past month trying to format the report. Any help would be greatly appreciated.

Scott

Sub test()

'

' test Macro

' Macro recorded 4/18/2005 by Scott

'

'

Range("C19").Select

Selection.Copy

Range("E14").Select

ActiveSheet.Paste

Application.CutCopyMode = False

Range("A1:L1").Select

SetBexCommand

End Sub

Function SetBexCommand()

Dim strCommand As String

Dim myCell As Range

strCommand = "HX03"

Set myCell = Range("D18")

<u>If Run("sapbex.xla!SAPBEXCheckCommand", strCommand, ActiveSheet.Range(strMyCell)) = 0 Then</u>

If Run("sapbex.xla!SAPBEXFireCommand", strCommand, ActiveSheet.Range(strMyCell)) = 0 Then

Else

MsgBox "Error in Hierarchy Command"

End If

End If

End Function