C# - Force Excel to ReCalc before Save

2019-07-24 01:51发布

Good Morning Overflow-ers!

I have been writing an agent which will open an Excel file, modify two cells and then save the workbook as well as a copy of this workbook.

What I really need is for just before the save, my agent to force a recalc on the whole workbook, so that all of my queries (which are in formula bars due to an inhouse add-in) re-run and get the latest values from an SQL Database.

If anyone could make any suggestions on this, that would be much appreciated.

Many Thanks

标签: c# excel
2条回答
对你真心纯属浪费
3楼-- · 2019-07-24 02:13

In theory, just xlApp.Calculate() should do the trick, based on the documentation.

查看更多
登录 后发表回答