当前位置: 动力学知识库 > 问答 > 编程问答 >

printing - MS Word commands from command line

问题描述:

I need to start MS Word from command line. Now, I pass these commands /q /n /mFilePrintDefault /mFileExit to it. In this case, I need manually press "No" on "save yes/no" dialog at the end (to close Word). What commands need to pass, to skip this (without saving or with saving doc) and automatically close Word?

网友答案:

In Word, create a macro in Normal.dotm using this code:

Sub CloseWithoutSaving()
    ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
    Application.Quit
End Sub

Then pass /q /n /mFilePrintDefault /mCloseWithoutSaving

网友答案:

I assume you are trying to print the document from the command line. You might want to do it the same way MS does it with right-click print. You can see details on this here:

http://www.robvanderwoude.com/ddecommandline.php

分享给朋友:
您可能感兴趣的文章:
随机阅读: