Я пишу макрос, который смотрит на адрес получателя, и если какое-то имя покажет сообщение vbYesNo msgbox. Однако он показывает мне msgbox при отправке мне (Aaron Islam).Проверить адрес перед отправкой
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
On Error Resume Next
' use lower case for the address
' LCase converts all addresses in the To field to lower case
RecipientsName = Item.Recipients
If RecipientsName = "Sarah Bloggs" Or "Sarah Smith" Then
If InStr(LCase(Item.To), "Sarah Smith" Or "Sarah Weedon") Then
Prompt$ = "You sending this to " & Item.To & ". Is it the correct one?"
If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Check Address") = vbNo Then
Cancel = True
End If
End If
Else: Exit Sub
End If
End Sub
Удалить после ошибки Продолжить. Ошибки будут генерироваться, чтобы вы могли их исправить. Особенно при отладке его следует удалить. – niton