WinWord.exe won't close

2019-08-26 21:31发布

问题:

I am running into issues creating a Word document Word from Excel using

Set wordapp = CreateObject("word.Application")
Set letter = wordapp.Documents.Add

On first run it works fine, on second run it hangs. I think the issue is if I close the document I created using the Close Button in Word, it won't close WinWord.Exe. I think it has to do with whether I saved the document or not. How can I get around this?

I uninstalled/deactivated all of my Add-ins (I heard that could be an issue) to no avail.

回答1:

try closing and releasing the objects

Set wordapp = CreateObject("word.Application")
Set letter = wordapp.Documents.Add

'release the letter object
set letter = Nothing
'quit the word appication
wordApp.Quit
'release the app object
set wordapp = Nothing