The most important thing when you are working with VBA in Analysis Office, is the refresh of the DataSource(s). Otherwise nothing works. Once a connection to the Business Warehouse is established, each DataSource needs to be refreshed.
If you have only one DataSource, that is the source code:
If you have more than one DataSource, this is the source code:
So that you know if the refresh was successful, you should use the following source code:
Therefore you can check lResult to 1 or 0. If you refresh the DataSource(s) each time, a lot of time is wasted. To counteract this, there is the following source code:
This command checks if the DataSource is already active. Here an example source code:
After this you can excute your own code.
These posts might also be interesting: