Click to See Complete Forum and Search --> : Need help in closing Excel Application...


FlipOver
September 19th, 2001, 08:33 AM
Hi there, i´m new in coding VB, and just started in a Corp programing an application, that between other things, should be able to send data from a grid to a new Excel Book, but, after everything's done, the Excel is still running in the task manager, even after I set the var_Excel to Nothing... I've been trying to resolve this one since Monday, and my time is realy running out. I'de apreciate some help, urgent. Thanks.
FlipOver

Iouri
September 19th, 2001, 08:51 AM
private xlapp as Excel.Application
private xlWorkbooks as Excel.Workbooks
private xlWbook as Excel.Workbook
private xlSheet as Excel.Worksheet

private Sub Command1_Click()
Dim intI as Integer

set xlapp = new Excel.Application
xlapp.Visible = true
set xlWorkbooks = xlapp.Workbooks
xlWorkbooks.Open "c:\myxls.xls" 'your excel

for Each xlWbook In xlWorkbooks
for intI = 0 to xlWbook.Worksheets.Count - 1
set xlSheet = xlWbook.Worksheets(intI + 1)
Debug.print xlSheet.Name 'you will find more than one sheet here!
set xlSheet = nothing
next intI
next

'this will close everything

set xlWbook = nothing
xlWorkbooks.Close
set xlWorkbooks = nothing
xlapp.Quit
set xlapp = nothing

End Sub



Iouri Boutchkine
iouri@hotsheet.com