![将默认设置设置为仅打印 MS Word 中的特定页面](https://linux22.com/image/1322820/%E5%B0%86%E9%BB%98%E8%AE%A4%E8%AE%BE%E7%BD%AE%E8%AE%BE%E7%BD%AE%E4%B8%BA%E4%BB%85%E6%89%93%E5%8D%B0%20MS%20Word%20%E4%B8%AD%E7%9A%84%E7%89%B9%E5%AE%9A%E9%A1%B5%E9%9D%A2.png)
如何将 MS Word 文档设置为默认仅打印前 x 页?我有一份很大的文档,但我不想打印它的人意外地打印了整份文档,而不是前 11 页(我希望他们打印)。
答案1
我相信做到这一点的唯一方法是创建宏。
将您喜欢的代码添加到您的宏中,并将 X 和 Y 更改为所需范围(在您的情况下为 1 和 11)。
如果希望显示打印对话框并允许选择任何范围,请使用此代码,但只需将默认设置为页面 XY:
Sub FilePrint()
With ActiveDocument
' unprotect
If .ProtectionType <> wdNoProtection Then
.Unprotect Password:="snip"
End If
.Bookmarks("RunSpellCheckButton").Range.Font.Hidden = True
With Dialogs(wdDialogFilePrint)
.Range = wdPrintFromTo
.From = X
.To = Y
.Show
End With
.Bookmarks("RunSpellCheckButton").Range.Font.Hidden = False
' reprotect
.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, Password:="snip"
End With
End Sub
如果您希望它在运行宏时自动打印 XY 页面,而不先显示打印对话框,请使用此代码:
Sub FilePrint()
With ActiveDocument
' unprotect
If .ProtectionType <> wdNoProtection Then
.Unprotect Password:="snip"
End If
.Bookmarks("RunSpellCheckButton").Range.Font.Hidden = True
.PrintOut Range:=wdPrintFromTo, From:="X", To:="Y"
.Bookmarks("RunSpellCheckButton").Range.Font.Hidden = False
' reprotect
.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, Password:="snip"
End With
End Sub
信用:杰伊·弗里德曼(微软 MVP)。