I have created an excel xls file from Access vba.
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 & "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
'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.
I have trawled the internet trying to find code that will close the file and quit excel - without success. Help!