View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Force iteration in workbook

You could create a new workbook that changes the calculation mode and then opens
the workbook that you want.

After it's done it's work, the macro would close the new workbook.

Option Explicit
Sub Auto_Open()

Dim TempWkbk As Workbook
Dim Wkbk As Workbook
Dim IsThereAnActiveWork As Boolean

Set TempWkbk = Nothing
On Error Resume Next
Set TempWkbk = ActiveWorkbook
On Error GoTo 0

If TempWkbk Is Nothing Then
IsThereAnActiveWork = False
Set TempWkbk = Workbooks.Add(1)
Else
IsThereAnActiveWork = True
End If

With Application
.Calculation = xlManual
.MaxChange = 0.001
End With

Set Wkbk = Workbooks.Open(Filename:="c:\my documents\excel\book1.xls")

If IsThereAnActiveWork = True Then
'do nothing
Else
TempWkbk.Close savechanges:=False
End If

ThisWorkbook.Close savechanges:=False

End Sub

Then open this helper workbook instead of opening the real workbook.




gump wrote:

I have a workbook that is shared and required iteration to be turned on for
the date calculations to work. How can I force this on everytime the
workbook is opened?


--

Dave Peterson