Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel process not terminating

Status
Not open for further replies.

mts176

MIS
Apr 17, 2001
109
US
I have written an application in VB 6.0, in this application I open up an Excel file, manipulate it and save it off as another name. I then reopen the original excel file. When I go to the task manager after closing out of the application, which closes the excel file, there is sometimes an excel process still running. If I do not manually end the processes I will eventually run out of virtual memory.

Question:
How do I absolutely ensure that the excel program closes totally.
 
How do you call the Excel Process... if it returns a PID (Process ID) then you can save the PID and when your done kill the process by the PID. Craig, mailto:sander@cogeco.ca

Si hoc legere scis, nimis eruditionis habes
 
Close the Excel application and then set the Excel object to nothing.

xlsApp.Close

Set xlsApp=nothing

Tibi
 
Here are my all of my subroutines dealing with opening and closing Excel

Public Sub CloseWorkbook()
On Error Resume Next
xlApp.Application.DisplayAlerts = False
xlApp.ActiveWorkbook.Close
End Sub
Public Sub OpenWorkbook()
On Error Resume Next
xlApp.Workbooks.Open ("C:\QuenchTest\Configuration\QuenchTest.xls")
xlApp.Visible = False
End Sub
Public Sub CloseExcelApp()
On Error Resume Next
xlApp.Application.DisplayAlerts = False
xlBook.Close
xlApp.Quit
Call ReleaseMem

End Sub
Public Sub ReleaseMem()
On Error Resume Next
Set xlBook = Nothing
Set xlApp = Nothing

'Stick stuff for destroying any global objects in here.
Dim frm As Form
'This loops through all your forms and unloads each one.
For Each frm In Forms
Unload frm
Next frm

End Sub
Public Sub OpenExcelApp()

MsgForm.Show
MsgForm.Refresh
MsgForm.MsgTextforOperator.Caption = "Opening Application"

Set xlApp = CreateObject("Excel.Application")
("C:\QuenchTest\Configuration\QuenchTest.xls")
xlApp.Workbooks.Open ("C:\program files\Keithley Instruments\ExceLINX\ExceLINX2.xla")
("C:\QuenchTest\Configuration\StandardQuench.xls")
xlApp.Workbooks.Open ("C:\QuenchTest\Configuration\QuenchTest.xls")
xlApp.Workbooks("QuenchTest.xls").Activate
xlApp.Visible = False
End Sub


The ExceLINX2.xla is an excel add-on, this must run for my program to function properly.
 
CraigSander, do you have a quick example of killing the process by the PID? Swi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top