避免outlook发信,忘记标题和附件
来源:互联网 发布:修改文件权限linux 编辑:程序博客网 时间:2024/06/02 05:07
在outlook 2003中添加“空邮件标题”和“空附件”检查功能
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)If TypeName(Item) <> "MailItem" Then Exit SubDim cancel_Subject As BooleanDim cancel_Attach As Boolean'CHECK FOR BLANK SUBJECT LINEIf Item.Subject = "" Thencancel_Subject = MsgBox("这个邮件没有主题." & vbNewLine & _"你确认要发送吗?", _vbYesNo + vbExclamation, "空主题") = vbNoEnd IfIf cancel_Subject = False Then'CHECK FOR FORGETTING ATTACHMENTDim intRes As IntegerDim strMsg As StringDim strThismsg As StringDim intOldmsgstart As Integer' ADDED BY LS >>>' - Does not search for "Attach", but for all strings in an array that is defined hereDim sSearchStrings(1) As StringDim bFoundSearchstring As BooleanDim i As Integer ' loop var for FOR-NEXT-loopbFoundSearchstring = FalsesSearchStrings(0) = "附件"sSearchStrings(1) = "文档"' ADDED BY LS <<<intOldmsgstart = InStr(Item.Body, "本邮件及其附件含有华为公司的保密信息,仅限于发送给上面地址中列出的个人或群组。")' intOldmsgstart is the location of where old/re/fwd/signature msg starts. Will be 0 if new msgIf intOldmsgstart = 0 ThenstrThismsg = Item.Body + " " + Item.SubjectElsestrThismsg = Left(Item.Body, intOldmsgstart) + " " + Item.SubjectEnd If' The above if/then/else will set strThismsg to be the text of this message only,' excluding old/fwd/re msg' IE if the original included message is mentioning an attachment, ignore that' Also includes the subject line at the end of the strThismsg string' ADDED BY LS >>>For i = LBound(sSearchStrings) To UBound(sSearchStrings)If InStr(LCase(strThismsg), sSearchStrings(i)) > 0 ThenbFoundSearchstring = TrueExit ForEnd IfNext i' ADDED BY LS <<<If bFoundSearchstring ThenIf Item.Attachments.Count = 0 ThenstrMsg = "附件检查:" & Chr(13) & Chr(10) & "你的邮件中提到附件, 但是你还没有上传附件." & Chr(13) & Chr(10) & "你确认要发送吗?"intRes = MsgBox(strMsg, vbYesNo + vbDefaultButton2 + vbExclamation, "你忘记上传附件啦!")If intRes = vbNo Then' cancel sendcancel_Attach = TrueEnd IfEnd IfEnd IfEnd IfIf (cancel_Subject Or cancel_Attach) = True ThenCancel = TrueEnd IfEnd Sub
下面来简单介绍怎么用,或者说怎么嵌入到outlook中:
a. 打开outlook
b. 按“Alt + F11” 键来打开VB Script
c. 点击左侧树状目录最下面的“ThisOutlookSession”,看到右边出现空白的编辑窗口
d. 把代码拷贝到编辑窗口,保存,退出VB Script编辑。(不用重启Outlook)
就这么简单,自己写个email测试一下功能看看?能否看到提示窗口?
经过测试,在Outlook 2002/2003/2007上通过。
对于“Missing Attachment”功能,补充两句:这段代码是检查Email正文中的关键词:attach, enclose,来判断是否要求添加附件。根据自己需要,可以添加关键词,比如“附件”等等。代码中有:
Dim sSearchStrings(1) As String
和
sSearchStrings(0) = "附件"
sSearchStrings(1) = "文档"
如果要增加关键词,就相应增加sSearchStrings(1)中的数字(如果有N个关键词,就为N-1),然后在下面添加相应的关键词,如:
sSearchStrings(2) = "attach"
- 避免outlook发信,忘记标题和附件
- 如何避免outlook发信,忘记标题和附件
- 如何避免outlook发信,忘记标题和附件
- 如何避免发Email忘记标题或附件
- 忘记帖附件?让Outlook自动提示
- Outlook 标题 附件 提醒 VBA 代码
- Outlook发邮件时忘记写主题或者添加附件的脚本解决方法
- 怎样在outlook中定时发信
- VBA实现outlook自动发信 2
- Web端调用Outlook 的发信窗口
- outlook 附件为灰色
- outlook打不开附件
- outlook附件保存位置
- 在 Outlook 中,为什么附件有时候显示在邮件正文中,有时候显示在标题中?
- Outlook Express和Outlook之间发送附件无法显示的问题
- javamail发信带附件的问题
- outlook 附件保存位置-附件无法打开
- 如何解决OUTLOOK无法访问附件
- WinCE开机自动运行
- Android中gravity与layout_gravity的区别
- 美国的辍学派
- Java:单例模式的七种写法
- 面试题:链表环的检测(Floyd判圈算法)
- 避免outlook发信,忘记标题和附件
- C_0 编写一个将输入复制到输出的程序,并将其中连续的多个空格用一个空格代替。
- js加密方法
- 10款最好的信息图创建工具
- HDU4509:湫湫系列故事——减肥记II
- 12 款优秀的 JavaScript MVC 框架评估
- android传说中的按两次返回键退出
- nodejs入门--process 进程
- TCP/IP详解--第七章