6

Is there any way that I can remove the Print item from the context menu when you right-click on an email with VBA?

I am forever right-clicking to reply to an email, only to accidentally click Print and have Outlook send it directly to the printer quicker than I can stop it.

alt text

NB: I am using Outlook 2007.

0

2 Answers 2

9
+100

Based on the link TcKs provide, that was pretty simple. In the example below I check the type of the item so that it only affects e-mails and not calendar items. To enter the code in outlook, Type Alt + F11, then expand the Microsoft Office Outlook Objects in the Project pane. Then double click the ThisOutlookSession. Then paste this code into the code window. I don't like to check captions like this as you can run into issues with internationalization. But I didn't see an ActionID or anything on the Command. There was a FaceID but that is just the id of the printer icon.

Private Sub Application_ItemContextMenuDisplay(ByVal CommandBar As Office.CommandBar, ByVal Selection As Selection)

   Dim cmdTemp As Office.CommandBarControl

   If Selection.Count > 0 Then

      Select Case TypeName(Selection.Item(1))

         Case "MailItem"

            For Each cmdTemp In CommandBar.Controls

               If cmdTemp.Caption = "&Print" Then

                  cmdTemp.Delete
                  Exit For

               End If

            Next cmdTemp

         Case Else

            'Debug.Print TypeName(Selection.Item(1))

      End Select

   End If

End Sub
3
  • Unfortunately, this doesn't work in Outlook 2013 anymore, although I replaced &Print with &Quick Print (which is the name of the context menu entry in Outlook 2013).
    – fero
    Aug 8, 2014 at 9:58
  • @fero Do you mean that it worked after you changed to &Quick Print? If not, did you ever find a solution for Outlook 2013? Thanks!
    – cxw
    Aug 18, 2017 at 13:23
  • No, I meant that it did not work although I changed it to &Quick Print. And no, I didn't find a solution for it. (Now using Outlook 2016)
    – fero
    Aug 21, 2017 at 6:44
8

Thera is sample how to programaticly working with Outlook: How to: Customize an Item Context Menu

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.