Refresh DSGRID functions in excel from VBA sub and wait for refresh to be finished before continu...

...ing with the code execution

Dear all,

We
have developed a portfolio optimisation code that runs with VBA over one excel
file that is in practice a support database.

The
code loops through several non linear weighting scenarios to arrive to an
optimum portfolio configuration.

During
these processes the system does not need to refresh data from DS as an initial
download is made before running the code.

But
once the stock selection is finished, we need to update several DSGRID cells
related to the selected stocks before continuing some further code lines.

We
are currently using this instruction for the intermediate refresh:

Application.COMAddIns("PowerlinkCOMAddIn.COMAddIn").Object.RefreshActiveWorkbook

Despite
it seems to be working, we do not know why or if other instructions would be
better

We
have used other instructions

Application.Run "PLRefreshWorkbookEventHandler"

And

Application.Run "EikonRefreshWorkbook"

The
problem is that we are not sure which is the proper refresh system as we
need synchronous refresh
(sequential), meaning the VBA code temporarily
stops execution until all refreshes are finished.

could you help us to clarify this issue?

Thank you very much in advance

Ivan

Best Answer