cancel
Showing results for 
Search instead for 
Did you mean: 

SAPBEx - Execute a query from an excel botton.

Former Member
0 Kudos

Hi,

I have the necessity to start a query (identified by a technical name) pressing a button using SAPBEx API.I have already defined a button in an excel sheet started as a query in SEM environment and I have observed that the button is always present in this excel sheet every time I start these specific query in SEM environment. The next and last step is to run a new query using its technical name that I see selecting the folder icon (open) - query and in the "History" section but maibe be in the "Favorites" or "InfoArea" sections.

Any suggestion is appreciated.

Thanks in advance.

Giovanni

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

I inserted this source code in my command button and it works correctly only in debugging mode.

strQueryID = "45181F5ZLMFWF53ZK3F1F0C2A"

strTmp = Run("SAPBEX.XLA!SAPBEXEmbedQuery", strQueryID)

If strTmp = "" Then

MsgBox "ERROR Insert Query"

End If

Referring to some post that I used as reference, I have avoided

ActiveWorkbook.Sheets("My Sheet").Range("A13").Select

because I received this error but I suppose that this is not the problem:

Error 91: Object variable or With block variable not set

but I can't find a solution changing my source code.

Any Idea?

Thanks in advance.

Giovanni