3
我有尝试设置的11x17纸作为默认的一些代码...2第二个“对错误转到”语句被忽略
On Error GoTo PageSizeErr
ActiveSheet.PageSetup.PaperSize = xlPaperTabloid
'更多代码在这里
PageSizeErr:
On Error GoTo PageErr2
ActiveSheet.PageSetup.PaperSize = xlPaper11x17 'try another 11x17 driver definition
GoTo resumePrinting
PageErr2:
MsgBox ("There's a problem setting Tabloid paper for the printer you have selected." & Chr(10) _
& "If you have an 11x17 printer selected, please contact EMBC, otherwise, try a different printer.")
Exit Sub
- -------------代码结束示例-----------------
当它到达第二个'ActivateSheet.PageSetup .. 。行,而不是去PageErr2标签,我得到一个错误对话框。 (我选择了不支持11x17的打印机,这是我试图测试的。)
需要多个错误处理程序,因为不同的打印机驱动程序似乎处理不同的设置。
为什么第二个'On Error goto'语句被识别?
只要改变你的“对错误转到”第二到一个goto就大功告成了。 – Kevin