View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick[_2_] Bernie Deitrick[_2_] is offline
external usenet poster
 
Posts: 176
Default Menu commands - overruling with macro - How to do it?

Jan,

In the codemodule of the ThisWorkbook object:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Cancel = True
FilePrint
End Sub

Put your FilePrint code into a standard module in the same workbook.

HTH,
Bernie
MS Excel MVP

"Jan Kronsell" wrote in
message ...
If I make a procedure like this in word:

Sub FilePrint()
MsgBox "hello"
End Sub

it will overule the normal File - Print menu command and the same

goes for
alle the menu commands.

How do I accomplish the same in Excel. I tried with the above code

in a
module, ThisWorkbook module and in a Sheet module.

am I doing someting wrong, or does it simply not work in Excel.

Jan