xlApp.Quit - Doesn't Close Instance.... Any ideas?
Hi Jim,
I did an even more basic test, just opening and closing an instance using
the following code.
It closed the instance as long as I didn't open and close a workbook - see
the 2 lines for opening and closing.
Sub CloseInstanceTest()
Dim xlApp2 As Excel.Application 'ADDED FOR MEMORY
Set xlApp2 = New Excel.Application 'ADDED FOR MEMORY
xlApp2.Visible = True
Dim wbCount, i
'If I don't do these lines of code, the Excel Instance closes.
'So as long as I don't open a file (which defeats the point), it works.
xlApp2.Workbooks.Open ("S:\C-0MNL0-0CB-001.xls")
wbCount = xlApp2.Workbooks.Count
For i = 1 To wbCount
xlApp2.Workbooks(i).Close
Next i
xlApp2.Quit
Set xlApp2 = Nothing
End Sub
"Jim Cone" wrote:
Looks correct.
Unfortunately, there is no syntax check when I write air code. <g
Jim Cone
"MikeZz"
wrote in message
After Further Review, I think I figured out the problem...
Set WB = xlApp.Open(FileName)
should be
Set WB = xlApp.Workbooks.Open(FileName)
|