1

Topic: Simple macro in Outlook

Good afternoon!
Prompt, please, there is a possibility to write in OUTLOOK here such macro.
There are 2 mail boxes - one personal, other general. The hand can sometimes tremble and the letter is written to a place of a personal box from the general.
It would be desirable that at attempt to send the letter (and it is better generally at a creation stage) in the general box, the warning was deduced.
Macroes in Excel I write, but about Outlook I do not know anything.
Thanks.

2

Re: Simple macro in Outlook

Private Sub Application_ItemSend (ByVal Item As Object, Cancel As Boolean)
Dim strMail As Object
Set strMail = Application. Session. Accounts. Item (2)
If strMail = "adress@mail.ru" Then
MsgBox "Ñîîáùåíèå"
Cancel = True
End If
End Sub

the Moderator: we Learn to use tags of design of the code - FAQ

3

Re: Simple macro in Outlook

4

Re: Simple macro in Outlook

5

Re: Simple macro in Outlook

All works!
Item (2) is not letter ordinal value!

6

Re: Simple macro in Outlook

Nik_Kurta wrote:

All works!
Item (2) is not letter ordinal value!

And what is it?
I test on while a personal box. The problem can in it?
Transferred the code in ThisOutlookSession, but still letters I go without acknowledgement.

7

Re: Simple macro in Outlook

Takayavot, check up adjustment of parameters of safety of macroes in MS Outlook

8

Re: Simple macro in Outlook

Nik_Kurta wrote:

Takayavot, check up adjustment of parameters of safety of macroes in MS Outlook

Changed temporarily on "enable all macros" and all the same did not help.