Excel VBA quit Word document

后端 未结 2 378
南旧
南旧 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:31

    I had the same problem. And only code below closed this Word window:

    Dim x As Variant
    
    X = Shell("powershell.exe kill -processname winword", 1)
    

    I found this code in one of the answers Closing word application from excel vba

提交回复
热议问题