you're using a mix of early and latebound code..
plus it may be easier to set a reference to the opened workbook
both the routines close completely on my machine..
(even if you set xl.Visible = TRUE
so you can test/see what's happening..)
Sub Early()
Dim XL As Excel.Application
Dim WB As Excel.Workbook
Set XL = New Excel.Application
Set WB = XL.Workbooks.Open("C:\temp\AnyOld.XLS")
WB.Close False
XL.Quit
Set XL = Nothing
End Sub
Sub Late()
Dim XL As Object
Dim WB As Object
Set XL = CreateObject("Excel.Application")
Set WB = XL.Workbooks.Open("C:\temp\Anyold.xls")
WB.Close False
XL.Quit
Set XL = Nothing
End Sub
--
keepITcool
|
www.XLsupport.com | keepITcool chello nl | amsterdam
Rex wrote :
After running this code, Excel remains:
Dim XL As Excel.Application
Set XL = CreateObject("Excel.Application")
XL.Workbooks.Open "C:\TEMP\AnyOld.XLS"
XL.Workbooks.Item(1).Close False
XL.Quit
Set XL = Nothing
Also tried .Close True and tried omitting .Close call.
What am I missing?
Rex