Disable Excel Automatic Calculation Results an exception

56 views
Skip to first unread message

Yanxun Hu

unread,
Apr 26, 2022, 10:47:16 AM4/26/22
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.
regards.

Govert van Drimmelen

unread,
Apr 26, 2022, 11:21:11 AM4/26/22
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?

 

-Govert

--
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.

adix

unread,
May 14, 2022, 12:16:28 PM5/14/22
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)

adix
Reply all
Reply to author
Forward
0 new messages