"Application.DisplayAlerts = False" Crashes Excel
<p>I have code which opens four workbooks, reformats data, pastes it into the current workbook then closes the other workbooks.</p>

<p>When I close the other workbooks I get a DisplayAlert asking me if I'd like to save the workbook. I want to stop the DisplayAlert appearing.</p>

<p>The recommendation by Microsoft:</p>

<pre><code>Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True
</code></pre>

<p>When I do this Excel crashes.</p>

<p>Code:</p>

<pre><code>Function rngFoundLog(searchDate As Date)

Set rngSearchLog = Workbooks("Ecom KPI.xlsm").Worksheets("Daily Update Log").Range("A:A")
Set rngFoundLog = rngSearchLog.Find(What:=Sheet1.searchDate, LookIn:=xlValues, LookAt:=xlPart)

End Function

Function formatHourlies(fileName As String) As Object

Dim fullFileName As String
fullFileName = ActiveWorkbook.Path &amp; "\Hourlies\" + fileName
Workbooks.Open fileName:=fullFileName

Workbooks(fileName).Worksheets("Top Line Metrics").Range("B9:H32").Copy
Workbooks(fileName).Worksheets("Top Line Metrics").Range("A34").PasteSpecial Transpose:=True

Workbooks(fileName).Worksheets("Top Line Metrics_0").Range("B9:H32").Copy
Workbooks(fileName).Worksheets("Top Line Metrics").Range("Y34").PasteSpecial Transpose:=True

Workbooks(fileName).Worksheets("Top Line Metrics_1").Range("N9:H32").Copy
Workbooks(fileName).Worksheets("Top Line Metrics").Range("AW34").PasteSpecial Transpose:=True

Workbooks(fileName).Worksheets("Top Line Metrics").Range("A34:BT40").Select
Selection.Replace What:="-", Replacement:="0", LookAt:=xlPart, _
    SearchOrder:=xlByRows, MatchCase:=False
Selection.Copy

End Function

Sub HourlyData()

Application.Calculation = xlManual
Application.ScreenUpdating = False
'Application.DisplayAlerts = False

Dim proxyServer As String
Dim clientID As String
Dim report_period As String
Dim report_date As String
Dim searchDate As Date

Sheet1.proxyServer = Worksheets("Update Data").Range("H2").Value
Sheet1.proxyStatus = Worksheets("Update Data").Range("H1").Value
Sheet1.report_date = Worksheets("Update Data").Range("B2").Value
Sheet1.searchDate = Worksheets("Update Data").Range("B3").Value

Dim answer As Integer
answer = MsgBox("Do you want to import the data?", vbYesNo + vbQuestion, "Import Data?")
If answer = vbYes Then

Dim StartTime As Double
Dim MinutesElapsed As String
Dim dateRange As Range
StartTime = Timer

reportDate = Worksheets("Update Data").Range("B3").Value
searchDatev2 = reportDate - 7

Set rngSearch = Worksheets("Business Objects").Range("A:A")
Set rngFound = rngSearch.Find(What:=searchDatev2, LookIn:=xlValues, LookAt:=xlPart)

Dim fileName As String
fileName = "couk Hourlies.xlsx"
formatHourlies (fileName)
Workbooks("Ecom KPI.xlsm").Worksheets("Hourlies").Range("B" &amp; rngFound.Row).PasteSpecial xlPasteValues
Workbooks(fileName).Close

fileName = "mcouk Hourlies.xlsx"
formatHourlies (fileName)
Workbooks("Ecom KPI.xlsm").Worksheets("Hourlies").Range("EQ" &amp; rngFound.Row).PasteSpecial xlPasteValues
Workbooks(fileName).Close

fileName = "ie Hourlies.xlsx"
formatHourlies (fileName)
Workbooks("Ecom KPI.xlsm").Worksheets("Hourlies").Range("KF" &amp; rngFound.Row).PasteSpecial xlPasteValues
Workbooks(fileName).Close

fileName = "mie Hourlies.xlsx"
formatHourlies (fileName)
Workbooks("Ecom KPI.xlsm").Worksheets("Hourlies").Range("PU" &amp; rngFound.Row).PasteSpecial xlPasteValues
Workbooks(fileName).Close

Workbooks("Ecom KPI.xlsm").Worksheets("Daily Update Log").Range("T" &amp; rngFoundLog(Sheet1.searchDate).Row).Value = Application.UserName

MinutesElapsed = format((Timer - StartTime) / 86400, "hh:mm:ss")

MsgBox "Data Import Completed in " &amp; MinutesElapsed

Else
 'do nothing

End If

Application.ScreenUpdating = True
Application.Calculation = xlAutomatic
'Application.DisplayAlerts = True

End Sub
</code></pre>