ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Howto prevent automatic calculation when open a CSV file (https://www.excelbanter.com/excel-programming/333037-howto-prevent-automatic-calculation-when-open-csv-file.html)

Steve

Howto prevent automatic calculation when open a CSV file
 
Even though the debug.print s shows the calculation to be xlManual, the
current sheet automatically calculates its cells when execute the following
code.

Is there anyway to prevent the auotmatic calculation when opening a CSV file?

Thanks!
Steve

==============================
Private Sub CommandButton1_Click()
Application.Calculation = xlCalculationManual

Debug.Print Application.Calculation
Dim wkb As Workbook
Set wkb = Application.Workbooks.Open("C:\test.csv", Format:=2,
delimiter:=",", ReadOnly:=True, UpdateLinks:=0, origin:=xlWindows)
'Set wkb = Application.Workbooks.Open("C:\test.xls")
Debug.Print Application.Calculation

wkb.Close
Set wkb = Nothing

Debug.Print Application.Calculation
End Sub
============================


All times are GMT +1. The time now is 10:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com