Set Manual Calculation in Excel

P

paulquinlan100

Hi

Im using c# to extract some data from Access and then insert it into
an excel workbook. I want to set calculations in excel to manual on
opening the book and then set it to revert to automatic once the data
has been inserted into the sheet.

Using vba i would use the following:

with Application
.calculation = xlManual
end with

Any ideas how i can do this is c#?
Thanks for any suggestions.
Paul
 
N

Nicholas Paldino [.NET/C# MVP]

Paul,

How are you getting it into the workbook? If you are opening an Excel
Application istance in C#, you can just set the Calculation property on the
excel instance to xlManual (the value should be included in the interop
assembly library as a constant or a value in an enumeration). This will
have the same effect as setting the property in VBA.

If you are using OLEDB (through the classes in the System.Data.OleDb
namespace) to populate the sheet, then when you are done, you will have to
open the sheet through automation, set the property, do whatever other work
you have to do, and then set it back.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top