我有一个带有自定义按钮的工作表,它是我控制打印过程的地方。
现在,用户单击菜单栏的打印图标,这将产生一个“未定义”的输出。
我怎样才能拦截这个菜单栏按钮?
发布于 2008-09-30 09:33:24
处理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在macro中,还可以重新定义系统宏本身。您必须创建一个名为FilePrint()的宏,Word将将其称为自己的宏。遗憾的是,你不能在Excel中做到这一点。
https://stackoverflow.com/questions/152314
复制相似问题