Every one perhaps encountered below situation:
1. When you sent a mail, you forgot to attachment the file you mentioned in the mail. So have to send again.
2. You forgot to write the Subject, so the receiver has to open your mail to read all the content.
To prevent this occurs again, you may use the Outlook Macro. The steps list below:
1. Click menu [Tools]->[Macro]->[Security]. And select the [Medium].
2. Click menu [Tools]->[Macro]->[Visual Basic Editor]. Then double click the left node [ThisOutlookSession], then replace the blank code with below:
Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Declare Function MessageBox& Lib "user32" Alias "MessageBoxA" (ByVal hwnd&, _
ByVal lpText$, ByVal lpCaption$, ByVal uType&)
Const MAX_PATH As Long = 260&
Const API_FALSE As Long = 0&
' MessageBox() Flags
Const MB_YESNO As Long = &H4& 'The message box will have a YES and NO button
Const MB_ICONQUESTION As Long = &H20& 'The message box will have the question mark graphic
Const MB_TASKMODAL As Long = &H2000&
Const IDYES = 6 'The return value when the YES button is pressed
Const IDNO = 7 'The return value when the NO button is p
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
hwnd = GetForegroundWindow()
Dim lngres As String
lngres = IDYES
'check the attchment
If InStr(1, Item.Body, "附件", vbTextCompare) <> 0 _
Or InStr(1, Item.Body, "attach", vbTextCompare) <> 0 _
Or InStr(1, Item.Body, "enclosed", vbTextCompare) <> 0 Then
If Item.Attachments.Count = 0 Then
lngres = MessageBox(hwnd, "你可能忘记加附件了。要发送吗?", "提示...", _
MB_ICONQUESTION Or MB_TASKMODAL Or MB_YESNO)
If lngres = IDNO Then Cancel = True
End If
End If
'check the subject
If Item.Subject = "" Then
lngres = MessageBox(hwnd, "邮件标题为空,仍然发送?", "提示...", _
B_ICONQUESTION Or MB_TASKMODAL Or MB_YESNO)
If lngres = IDNO Then Cancel = True
End If
End Sub
After this, click menu [debug]->[compile project1]. Save and close. Restart Outlook.
There will popup a warning dialog, click the [Enable Macros].