Excel running after close

E

Ed

I have written an Excel VBA Add-in function that is used in
myWorkbook.xls. The function
opens Word and uses a data in one of the myWorkbook.xls worksheets as
the database for filling in a Mail Merge fields in the Word document.
A complication is
Excel won't let me do this directly from the myWorkbook.xls worksheet.

The workaround was to copy the needed worksheet to a new temporary
workbook tempJCNAFormsWks.xls
and use it as the Mail Merge data source:

Sheets(strWksName).Select
Sheets(strWksName).Copy
ChDir strMembershipDir
ActiveWorkbook.SaveAs fileName:=strMembershipDir &
"\tempJCNAFormsWks.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False

(invoke Word... )

After the invocation of Word finishes, I close and Kill
tempJCNAFormsWks.xls:

On Error GoTo 0
Set wdApp = Nothing
ActiveWorkbook.Close
Kill strMembershipDir & "\tempJCNAFormsWks.xls"

That works great. The only problem is after saving myWorkbook.xls and
closing Excel I can still see
Excel.exe in the Wondows Task Manager.

Why is it doing this?

TIA

Ed
 
G

Gary''s Student

You may have more than one instance of Excel open. You would need to do
something like:

Sub leavit()
Application.Quit
End Sub

in each instance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top