View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Steve Steve is offline
external usenet poster
 
Posts: 1,814
Default 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
============================