When more than "ItemSend" is needed

ENLLP

New Member
Hi could someone help?

I have a Add-in in Outlook (Newforma) that uses the Application_ItemSend function. You can send an email by clicking on Outlooks Send button or on this Addins button.

I wanted to write a small msgbox to remind people to use the Addin when they click on Outlook's Send button.

However because both these buttons trigger the Application_ItemSend my macro runs regardless which button I click.

I need a way to only trigger my code when the Send button is pressed by the user not when the Application_ItemSend function is sent please?

I am a beginner to VBA so if answers could be in full that would be most helpful.

Thank you in advance, here's the code I have done so far:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

If MsgBox("Make sure you are sending using Newforma - Are you sure you want to send this message?", vbYesNo + vbQuestion + vbMsgBoxSetForeground, "WARNING - NEWFORMA BYPASS ?") = vbNo Then

Cancel = True

End If


End Sub
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Looking for what? If you only need to support Outlook 2010 and older, that would be easier. If 2013 and up, what language would you be using, do you have Visual Studio for creating an Addin? If you don´t have any experience in creating and deploying Addins, I´d first ask the vendor of NewForma to customize their Addin for you. That could be cheaper.
 

ENLLP

New Member
I can see I'm getting a flat "No it cant be done" in this forum ;-) but in some others their exploring the idea of using the Cancel button as a trigger. this still hasn't work but its made me think that clicking on the cancel might cause an event that can be used to differentiate between the 2?

Private Sub Newforma()
' Cancel = True is a flag indicating Newforma invoked Application_ItemSend
Application_ItemSend CreateItem(0), True
End Sub

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

If Cancel = False Then ' User clicked the Send button
If MsgBox("Make sure you are sending using Newforma - Are you sure you want to send this message?", vbYesNo + vbQuestion + vbMsgBoxSetForeground, "WARNING - NEWFORMA BYPASS ?") = vbNo Then

Cancel = True

End If

Else
' Cancel starts as True when Application_ItemSend was invoked by Newforma
' Reverse the Cancel
Cancel = False

End If

End Sub
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Maybe you´d get better answers if you´d share details. We still don´t know which versions of outlook you want to support. If using NewForma´s Send button instead of Outlook´s button is important, NewForma really could be interested in overwriting Outlook´s button as mentioned. Did you ask them?

Since the NewForma Addin for sure doesn´t call your NewForma procedure when you click its Send button, that approach cannot work.
 

Similar threads

Top