VBA: AsyncCalculations
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