Question:
Hi!
I have seen this question in other topics but I could not find the answer.
I am adding this simple code in the VBA editor:
Sub SAPBEXonRefresh(queryID As String, resultArea As Range)
MsgBox ("Hello World")
End Sub
But when i try to save it i get this message:
xSAPtempNNNN.xls is a read only file. Make a copy...
Do I have a security issue ?
Thanks in advance!!
Yolanda
Answer:
You need to save it within the BW (as a workbook) or as a copy in a windows environment (using "Save as...").
Leandro
Answer:
Hi Leandro,
This is what I am doing:
I excuted my Query.
Saved it as a woorkbook.
Tools -> Macros -> VB Editor
There I have available VBAP Project (xSAPtemp2615.xls).
In the modules for this project I find SAPBEX Module. The code looks like this:
Sub SAPBEXonRefresh(queryID As String, resultArea As Range)
End Sub
inside the sub i added the: MsgBox ("Hello World") .
Then when i try to save it it tells me that xSAPtemp2615.xls is a read only file. If I save it as... locally the code does not execute when I run the woorkbook. So i guess that I am not within the BW after all.
Why?
Thanks for your help!
Answer:
Until you enter "Hello world" everything fine.
Then...
1) save it as a workbook again
or
2) save it locally
Both options should work. Make sure you don't have more than one workbook open when you do this. Otherwise can be confusing.
You say you save it locally and it did not execute your code. But then, does it refresh the query? If the query is refreshed, you are in the BW, and it should go into the code.
Leandro
Answer:
OK!!!!
So you have to save the woorkbook not the VB project.
Thanks a lot it is working just fine
P.D. (when i saved it locally it worked only for that execution or when I opened the sheet just as an excel)