[VB6] zamykanie excela z procesów


(Grzeniux) #1

Hej w jaki sposób zamknąć excela przez vb6 tak aby zniknął on z procesów???

Kod mam taki do zamykania i działa ok ale excel zostaje w procesach i nie wiem jak się go pozbyć

Private Sub Command8_Click()

Dim objExcl As Excel.Application
Dim objWk As Excel.Workbook
Dim objSht As Excel.Worksheet


Command8.Enabled = False
'On Error Resume Next

Set objExcl = New Excel.Application
objExcl.Application.Visible = True

    sciezka = Text27.text

Set objWk = objExcl.Workbooks.Open(sciezka)
Set objSht = objWk.Sheets(1)


 objWk.Sheets("LOADING PLAN").Select

    Cells.Find(What:=Text35.text, After:=Range("A1"), LookIn:=xlValues, _
        LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
        MatchCase:=False, SearchFormat:=False).Activate


Selection.Offset(0, 13).Select
ActiveCell = Text28.text
Selection.Offset(0, 2).Select
ActiveCell = Text8.text
Selection.Offset(15, 0).Select
 
 



objWk.Save
objWk.Close

'objExcl.Close
Application.Quit

 

'objSht = Nothing
Set objSht = Nothing
Set objWk = Nothing
Set objExcl = Nothing


'Shell ("taskkill /f /im excel.exe")
Command8.Enabled = True

  Text35 = Clear
  Text8 = Clear

Text8 = ""
Text35 = ""

End Sub