Disable Excel Automatic Calculation Results an exception

Skip to first unread message

Yanxun Hu

Apr 26, 2022, 10:47:16 AMApr 26
to Excel-DNA
Hi together
I am trying to disable automatic calculation in excel

using ExcelDna.Integration;
using Excel = Microsoft.Office.Interop.Excel;

Excel.Application app = (Excel.Application)ExcelDnaUtil.Application;
app.Calculation = Excel.XlCalculation.xlCalculationManual;

this this always throws exception
how do I go around this.

Govert van Drimmelen

Apr 26, 2022, 11:21:11 AMApr 26
to exce...@googlegroups.com

That should work, but you probably won’t be able to call it inside a worksheet function.


Are you trying from a ribbon button or macro?



You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/exceldna/6782733a-4df4-4396-b73b-31280cb55bd0n%40googlegroups.com.


May 14, 2022, 12:16:28 PMMay 14
to Excel-DNA
you cant access or change the .Calculation .. once a calculation is running.
This is only possible once Application.CalculationState = 0 (xlDone  = 0) | otherwise the .CalculationState = 1 (xlCalculating = 1)
I used a function with a stopwatch to catch such a situation. (max. wait 5 seconds)
You can then likewise use fixed constants like oApp.Calculation = -4105    'xlCalculationAutomatic ( -4105)

Reply all
Reply to author
0 new messages