I have a sheet with a custom button on it from where I control the printing process.
Now the user clicks on the menu bar's print icon and this produces an "undefined" output.
How can I intercept this menu bar button?
Handle the Workbook_BeforePrint event.
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
In MS Word, it's also possible to redefine the system macro itself. You'd have to create a macro named FilePrint(), and Word would call it instead its own. A pity you can't do that in Excel.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With