Link to home
Start Free TrialLog in
Avatar of Buck Beasom
Buck BeasomFlag for United States of America

asked on

How do I set Excel Calculation Options to Manual from code using Late Binding.

I have Excel workbooks with lots of formulas in them that I populate from Access Code. All the workbook templates are set to "Manual Calculation" but if the user has another Excel workbook open that is set to Automatic, the template switches to Automatic when it opens.

Is there a way to set it back to Manual before starting the populating? When it's manual, the program runs MUCH slower.

Thanks.
Avatar of Kanti Prasad
Kanti Prasad

Hi

If it is possible ask the users to go to Formulas and set the calculations to Manual for this file.

Excel will use the setting of the 1st opened file in a session. Hence, one option is to code to open a dummy excel in manual mode and through  it open, your excel file. This way your excel will take the manual settings of the opened dummy file.

 

 try the below by opening a macro and pasting the below code and if it dont help then you need to do the above

Private Sub Workbook_Open()
  Application.Calculation = xlManual
End Sub
ASKER CERTIFIED SOLUTION
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Buck Beasom

ASKER

In my experience, "xl" commands that would be generated by recording an Excel Macro do not function when using late binding. I will try "objExcel.Calculation = -4135, as I have successfully used some other "-4###" to minimize an open Excel application once it is loaded. Will let you know the results.

Thanks.
Worked perfectly.

Thanks.