Excel running after close

  • Thread starter Thread starter Ed
  • Start date Start date
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
 
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

Simplify save code 11
Hiding an Excel file using VBA 1
SaveAs to existing file 5
Enable/Disable Macro 2
Save with ref. to cell A1 2
Save As File Format 1
Save as marco 3
Create CSV 3

Back
Top