event by klicking on new email (system) button

A

Arasch Sajjadi

hello,

i need your help please. which event would fire by clicking on the system
button: "New Email".

I don't want to implement my own button. Simply use the system button. I
haven't found any event.

thanks a lot

arash
 
E

Eric Legault [MVP - Outlook]

Add the code below to your ThisOutlookSession module:

Option Explicit
Dim WithEvents objNewMailButton As Office.CommandBarButton

Sub SetHandleToNewEmailButtonClickEvent()
Dim objBar As Office.CommandBar, objNewButtonGroup As
Office.CommandBarPopup

Set objBar = ActiveExplorer.CommandBars("Standard")
Set objNewButtonGroup = objBar.FindControl(, 1874)
Set objNewMailButton = objNewButtonGroup.Controls("Mail Message")

Set objBar = Nothing
Set objNewButtonGroup = Nothing
End Sub

Private Sub objNewMailButton_Click(ByVal Ctrl As Office.CommandBarButton,
CancelDefault As Boolean)
MsgBox "I've been clicked!"
End Sub
 
A

A Yadav

Is it possible to somehow handle the clicking of the "New" button in the
"Standard" toolbar. It is a CommandBarPopup and would it possible to handle
the event for "New" like you did for "New Mail" in the code below.

Thanking in advance

Abba
 
Top