Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Int32, ByVal wMsg As Int32, _
ByVal wParam As Int32, ByVal lParam As Int32) As Int32
Const WM_QUIT = &H12
Private Sub ExcelWorker
MyExcel As Microsoft.Office.Interop.Excel.ApplicationClass
'Blah Blah Blah Do all your Excel Stuffz
MyExcel.Quit
PostMessage(Excel.Hwnd, WM_QUIT, 0, 0)
Dim i As Int32
For i = 0 To 10000
Application.DoEvents()
Next
MyExcel = Nothing
End Sub
|