VBA: AsyncCalculations

Created by Damien Zwillinger, Modified on Thu, 5 Oct, 2023 at 5:51 PM by Gabriel Michaud

Applies to:

  • Velixo Classic
  • Velixo NX (when used with Excel on Desktop)


Important: Visual Basic for Applications macros are not supported by Excel Online.


Purpose

Provides a means to ensure that all Excel calculations have been completed prior to proceeding with the rest of the code in the VBA macro.

 

For details, see Ensuring that all calculations are done before proceeding.

 

Syntax

objVelixo.AsyncCalculations = False

objVelixo - a variable that represents an instance of the Velixo VBA functions class.

 

Example

 

Once we have created your Velixo object, we can set the AsyncCalculations property to FALSE, and continue with whatever else our macro needs to do.

Dim velixoObj As Velixo_Reports.VBA
Set velixoObj = CreateObject("Velixo.Reports.Vba")

Application.EnableEvents = False
Application.Calculation - xlCalculationManual

velixoObj.AsyncCalculations - False

strPeriod = InputBox("Financial period to check?")
Sheet1.Range("B2").Value = strPeriod

'Because calculation is manual; we have to trigger the recalculation 
Sheet1.Calculate 

'if we reference that cell here, 
'our code will wait until Excel has 
'completed its recalculation process.

'Once we are done, let's put everything back to normal settings
Application.StatusBar = ""
velixoObj.AsyncCalculations = True
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
Application.ScreenUpdating = True

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article