Word 文档打印来自 Excel 错误命名参数未找到

Word doc print from Excel Error Named argument not found

Dim WA As Object, WD As Object
    Set WA = CreateObject("Word.Application")

Set WD = WA.Documents.Add(Filename)
    With WD
        .PrintOut Copies:=1, _
             Collate:=True, IgnorePrintAreas:=False, Preview:=False
    End With
WD.Close False
WA.Quit False
Set WD = Nothing
Set WA = Nothing

我收到错误 "Named argument not found",仅有效

.PrintOut Copies:=1

但是它向我显示了错误文档边距的警告

通过单击 "Tools" ---> "References..." 然后单击 "Microsoft Word 15.0 Object Library" 旁边的复选框在我的项目中引用。已选择

this parameters 个工作 那么如何打印所有我需要的参数呢?

Word 的 Printout 方法没有 IgnorePrintAreasPreview 参数。这里有可用参数的列表:https://msdn.microsoft.com/en-us/library/office/ff837331.aspx?f=255&MSPPError=-2147217396

您可以使用以下方式抑制页边距警告:

WA.Displayalerts = 0
WD.PrintOut Copies:=1, Collate:=True
WA.Displayalerts = -1