Hi Sarah,
just use the name of technical infoprovider of crosstab in your macro as following.
The call of refresh is used in the following order ( I use two queries in my actual Workbook
Sub btn_refresh()
Dim lResult As Long
lResult = Application.Run("SAPExecuteCommand", "Refresh", "DS_1")
lResult = Application.Run("SAPExecuteCommand", "Refresh", "DS_2")
End Sub
The technical name "DS_1" or as shown below "DS_2" can be found by selecting the crosstab (data area) then display components tab of Pivot area as shown in figure and unfold until you see the crosstab.
Select the crosstab.
Name of query (in my case DEMO BW IP) and technical datasource are displayed.
Image may be NSFW.
Clik here to view.
If you do the same "By Data Source (shown below) you may eveb change the technical name from "DS_2" to maybe "SARAH" or whatever plausible name.
Image may be NSFW.
Clik here to view.
In that case the refresh seqquensneeds to be changed as well
lResult = Application.Run("SAPExecuteCommand", "Refresh", "SARAH")
Hope that helps
Joerg Boeke