2015-10-29 4 views
-1

Моя адресная книга Outlook по умолчанию хранит адреса электронной почты в комбинации букв верхнего и нижнего регистра, в этом случае код ниже для меня не работает. Пожалуйста, порекомендуйте.Предупреждение перед отправкой сообщения Outlook

+0

Так какой у вас код? –

+0

под кодом? где это? –

ответ

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

    Dim Recipients As Outlook.Recipients 
    Dim recip As Outlook.Recipient 
    Dim i 
    Dim prompt As String 


On Error Resume Next 
' use lower case for the address 
' LCase converts all addresses in the To field to lower case 

    Checklist = "[email protected]" 


Set Recipients = Item.Recipients 
    For i = Recipients.Count To 1 Step -1 
    Set recip = Recipients.Item(i) 

If InStr(LCase(recip), LCase(Checklist)) Then 
     prompt$ = "You sending this to this messgae to Treasurer " & Item.To & ". Are you sure you want to send it?" 
     If MsgBox(prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Check Address") = vbNo Then 
     Cancel = True 
     End If 
    End If 

Next i 


End Sub