3

我有一张纸,上面有一个自定义按钮,我可以从中控制打印过程。

现在用户点击菜单栏的打印图标,这会产生一个“未定义”的输出。

如何拦截此菜单栏按钮?

  • 谢谢
4

1 回答 1

3

处理 Workbook_BeforePrint 事件。

private sub Workbook_BeforePrint (cancel as boolean)
  '//g_MyFlag is set when the user clicks you toolbar button.
  '//It must get cleared in the end of your procedure.
  if not g_MyFlag then cancel = true: exit sub

end sub

在 MS Word 中,也可以重新定义系统宏本身。您必须创建一个名为 的宏FilePrint(),Word 会将其称为自己的。可惜你不能在 Excel 中做到这一点。

于 2008-09-30T09:33:24.250 回答