Force excel 2007 to open in automatic calculation mode by default

对着背影说爱祢 提交于 2020-01-07 05:37:04

问题


I am working with excel application(AddIn) in excel/c#, getting a circular reference error which disappears when I enable automatic recalculation through excel options.
But I want to set Automatic option as default when the file opens, but for some reason it wont let me just save the .xlsx file as automatic option enabled. I found some articles stating that you have to have a personal.xlsx file in your XLStart folder with the desired settings which is used by other sheets as reference, which I created and all my local excel sheets works fine with automatic option by default except this one template (template.xlsx). The template is used to populate data and it has 29 sheets in it. So I don't know if that's creating the problem. So now when I open excel, it opens the personal.xlsx first which has Automatic option enabled, but then, when the template.xlsx opens the option changes to "manual". Then I have to manually change it to Automatic option every single time. But all other .xlsx files in my PC opens in Automatic option by default.

How to fix this?


回答1:


As I found in MSDN :

The user can select the mode through the Excel menu system, or programmatically using VBA, COM, or the C API.

1) You can change the option for a specific range by this:

Just with VBA:

Range.Calculate (introduced in Excel 2000, changed in Excel 2007)

and 

Range.CalculateRowMajorOrder (introduced in Excel 2007)

2) Change option for Active Worksheet

By Keystroke: : SHIFT + F9

--VBA:--
ActiveSheet.Calculate

--C API:--
xlcCalculateDocument

3) Change option for All Open Workbooks

By Keystroke: F9

--VBA:-- 
Application.Calculate

--C API:-- 
xlcCalculateNow

For More read this MSDN article



来源:https://stackoverflow.com/questions/8085598/force-excel-2007-to-open-in-automatic-calculation-mode-by-default

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!