Skip to Content
Former Member
Jun 03, 2005 at 01:15 AM




Can anyone help me or provide working VBA examples of the

SAPBEXsetVariables function.

I have tried using the code below but get an 'object required' error.

‘Set the values for Variables

Dim rngVar as Range

Set rngVar = YOUR_VARIABLE_SHEET.Range(“A2:H3”)

Run "SAPBEXsetVariables", rngVar

If Run("SAPBEX.xla!SAPBEXrefresh", False, ActiveSheet.Range("C7")) = 0



MsgBox "Error in Refresh”

End If

I have a workbook with several queries on different tabs. Each query

has the variable 'Month'. Every month I have to update the variables for

all queries in the workbooks,

which automatically forces a query refresh. This obviously means that

there is no point using the SAPBEXrefresh function as the query has

already been refreshed.

I have working VBA code to logon to BW and refresh the queries.

Aa ideal solution would be to set the variables in a cell in the

spreadsheet, then schedule the code to run to logon to BW, update the

variables, refresh the query and

save the spreadsheet.