葡萄架上的牵牛花

东拼西凑之东成西就
posts - 202, comments - 247, trackbacks - 10, articles - 0

Outlook 2003本身没有空白主题邮件发送前警告功能,但利用Outlook 2003的VBA功能,很容易实现之。

请按Alt+F11(或者从菜单的工具-宏-Visual Basic Editor)进入VBA编辑画面,双击左边的“ThisOutlookSession”,拷贝粘贴以下代码即可。

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

  'CHECK FOR BLANK SUBJECT LINE
  If Trim(Item.Subject) = "" Then
        bCancelSend = MsgBox("本邮件没有主题。" & vbNewLine & _
                        "你真的想就这样寄出去吗?", _
                        vbYesNo + vbExclamation + vbDefaultButton2, "缺少主题") = vbNo
  End If

  'Cancel sending message if answered yes to either message box.
  Cancel = bCancelSend

End Sub

最后别忘了给你的代码数字签名(VBA编辑窗口的菜单 工具-数字签名),否则下次启动Outlook时,你的代码会被自动无效化。你可以用“SELFCERT.EXE”这个工具(在我的电脑中它在C:\Program Files\Microsoft Office\OFFICE11目录里面,安装Office时可以选择安装的)生成一个自己专用的数字签名。

若你还想检查是否把附件忘记了,请参看 Jeremy Gollehon's Application_ItemSend Event 1.0

Post Comment

Title  
Name  
Url
Comment   
Protected by Clearscreen.SharpHIPEnter the code you see: