Excel background process does not quit

oldcitycat

Board Regular
Joined
Sep 23, 2011
Messages
71
Would someone please explain why the Excel process continues to run even after Closing and Quitting.
From my limited understanding I thought sourceWB.Close & xlApp.Application.Quit would do the trick.
What Am I missing?


Code:
Private Sub UserForm_Initialize()If TimeCard.tbEmployeeID.Value = "" Then
LoadTimeCard
Else: Exit Sub
End If
End Sub


Code:
Function LoadTimeCard()Dim sourceWB As Workbook
Dim sourceWS As Worksheet
Dim xlApp As Object


Set xlApp = CreateObject("Excel.Application")


With xlApp
    .Visible = False
    .EnableEvents = False
End With


strFile = "C:\TimeCard\PCI_TimeCard.xlsm"


Set sourceWB = Workbooks.Open(strFile, , True, , , , , , , True)
Set sourceWS = Worksheets("2678")
sourceWB.Activate


TimeCard.tbEmployeeID.Value = Worksheets("2678").Range("C2")
TimeCard.tbEmployeeName.Value = Worksheets("2678").Range("C3")
TimeCard.tbDepartment.Value = Worksheets("2678").Range("C4")
TimeCard.tbPayPeriod.Value = Worksheets("2678").Range("C5")


sourceWB.Close
xlApp.Application.Quit
Set xlApp = Nothing
End Function

Thank you in advance for any and all suggestions
OldCityCat
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
have you started a clock somewhere?
 
Upvote 0
if you start a timer you have to stop it implicitly, closing excel dosen't do it (unless you do a s system restart)
 
Upvote 0
That makes perfect sense, but to my knowledge I have not started any timers.
Do you see something in the code that indicates a timer is running?
 
Upvote 0
That UserForm_Initialize function, is that in Excel workbook or some other app like Word or Access?

If it is in another Excel workbook, then that means that you have two Excel processes when running the function LoadTimeCard. After LoadTimeCard function kills process created in it, the process running the Userform function still remains.
 
Upvote 0
It an Outlook Userform that reading and writing to Excel.
I have verified that Excel is not running before opening the TimeCard form.
The form load correctly with the data from Excel.
When I exit the form via the X on the form then check task manager Excel is still running as a background process
 
Upvote 0
2 things to try
1) do not close the workbook first.
2) In excel options > Trust centre > Trust centre settings > Macro settings > Trust access to the VBA project
 
Upvote 0
I just made a discover, that If I close Outlook then Excel background process ends.
I'm wondering if it's because the form is opening it "ThisOutlookSession"

Code:
Public Sub OpenUserForm_Click()TimeCard.Show vbModal
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,999
Members
452,373
Latest member
TimReeks

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top