朋友们,我正在尝试在使用打印输出命令时禁用显示警报。代码不起作用,因为我收到运行时错误,例如“只读”、“字转换器”、“无效的引用类型”。我想压制所有这些错误。我的代码在下面您能否确认如何在 2007 年对同一个单词进行编码,这在 2003 年的单词中可以正常工作。
If optCentral.Value = False Then
Set oPrint = GetObject(lbxResults.List(varLoop))
End If
End If
If optCentral.Value = True Then
'do nothing, already copied
ElseIf optPtrOver.Value = True Then
With oPrint
'Store existing print settings
bValueStoreUFAP = .Application.Options.UpdateFieldsAtPrint
bValueStoreULAP = .Application.Options.UpdateLinksAtPrint
bValueStoreDisplayAllerts = .Application.DisplayAlerts
'Change print settings, stops unwanted pop-up boxes
.Application.Options.UpdateFieldsAtPrint = False
.Application.Options.UpdateLinksAtPrint = False
.Application.DisplayAlerts = wdAlertsNone
'Print document
.PrintOut copies:=varCopies
'Restore original print settings
.Application.Options.UpdateFieldsAtPrint = bValueStoreUFAP
.Application.Options.UpdateLinksAtPrint = bValueStoreULAP
.Application.DisplayAlerts = bValueStoreDisplayAllerts
.Saved = True
.Close