Hi,
Apologies if you've seen this post in other forums but it's amazing how many forums exist for Excel/VBA.
I've been trying to write some code in Excel that will open Word, perform a mail merge on the last line of a data contained in the worksheet, and then close Word. My code performs the merge asking me to save both the merged document and the original document which is all fine; at present I am closing Word manually but may automate this. The problem I am getting, like a lot of others who have tried a similar thing, is that once I have saved and closed my spreeadsheet then quit Excel, it is still running as a process in the background. I have got a workaround that works whereby I first copy the last line of data into a seperate workbook then run the mailmerge code from within Word but I would prefer the more streamlined version if possible. The code I have so far is as below:
Any help would be greatly appreciated. The only similar instances I could in the forum were where Excel was called from somewhere else and wouldn't close - the solutions tended to be focussed on closing Excel from within the code which isn't something I'm trying to do.
The merge code was generated by the macro recorder within Word.
Bookmarks