Link to home
Start Free TrialLog in
Avatar of kim_wei
kim_wei

asked on

shut down excel

hello, all,

  i am using MEXCEL automation to create excel book, sheets in my VB application, it is running fine. At final of this application, a piece of code looking like following is used to close excel , however, when i check "Taskmanager", i can still find "excel.exe" exising there,  what is that, how can i really stop excel? developing environment is Window XP, VB6.0 (SP 5)

'to close excel
...  
xlBook.Close
Set xlApp3 = Nothing
...

thanx in advance
 
Avatar of ZenMasterrr
ZenMasterrr

try
 xlApp3.Quit
Hai,

Try like this
'Open Excel
Dim oExcel As New Excel.Application
Application.DisplayAlerts = False 'No prompts to overwrite file
oExcel.Visible = True
oExcel.Workbooks.Open FileName:= "C:\myFile.xls"
'Close Excel
oExcel.Close
oExcel.Quit
Set oExcel = Nothing

Bye
Ajai
ASKER CERTIFIED SOLUTION
Avatar of ajaikumarr
ajaikumarr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hai,

Sorry like this...

Private Sub Command1_Click()
On Error GoTo ErrorHandler:
    'Open Excel
    Dim oExcel As New Excel.Application
    Application.DisplayAlerts = False 'No prompts to overwrite file
    oExcel.Visible = True
    oExcel.Workbooks.Open FileName:="C:\myFile.xls"
    GoTo ExitExcel

ErrorHandler:
    MsgBox "Error Occuered"
    GoTo ExitExcel

ExitExcel
    'Close Excel
    oExcel.Close
    oExcel.Quit
    Set oExcel = Nothing
End Sub


Bye
Ajai