I'm using Windows 7 with MS Office 2007 and I have written some VBA code inside MS Word 2007 that performs a Mail Merge with an Excel Workbook. When the program is complete I want the code to close the Excel Application. The code
seems to work when Excel was originally opened by the program but it doesn't seem to work when Excel is already open.
Can anyone tell me how I can have the program check to see if Excel is open and if it is, close it?
Code:
Excel.Application.ActiveWorkbook.Close False
Excel.Application.Quit
Can anyone tell me how I can have the program check to see if Excel is open and if it is, close it?