Excel VBA quit Word document

后端 未结 2 429
南旧
南旧 2021-01-19 03:03

I have a macro that inserts select cells of an Excel document into a Word template, copies the entire Word document then closes the document without saving, to preserve cert

2条回答
  •  耶瑟儿~
    2021-01-19 03:33

    Please add the below to your code:

    appWd.Quit
    

    This would be between

    appWd.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
    

    and

    Set appWd = Nothing
    

    That calls the WinWord Quit method, which should solve your problem.

提交回复
热议问题