title: Close Excel file from Access vba
body: <p>I have created an excel xls file from Access vba. </p>
  
  <pre><code>Private Sub ModifyXl()
  
  Dim XLapp As Excel.Application
  Dim xlWB As Excel.Workbook
  Set XLapp = New Excel.Application
  Dim xlSh As Excel.Worksheet
  
  Set xlWB = XLapp.Workbooks.Open(DskTp &amp; "NHL Doctors.xls", , False)
  Set xlSh = xlWB.Sheets("NHLDocs")
  
  Cells.Select
  Selection.Font.Name = "Trebuchet MS"
  Rows("1:1").Select
  Selection.Font.Bold = True
  Range("A1").HorizontalAlignment = xlCenter
  Columns("A:A").EntireColumn.AutoFit
  
  xlWB.Save
  xlWB.Close
  XLapp.Quit
  Set XLapp = Nothing
  
  End Sub
  </code></pre>
  
  <p>'Cells.Select' didn't work but the file now exists. I can't delete it because it says it is already open - but it doesn't appear as open.</p>
  
  <p>I have trawled the internet trying to find code that will close the file and quit excel - without success. Help!</p>