Outlook 2010 附件检查器宏 - 只有我写的
Outlook 2010 Attachment Checker Macro - Only what i write
我一直在 outlook 2010 中使用下面的代码来提醒我添加附件,如果我在电子邮件中引用了一个附件而忘记附加任何东西。但是,我想知道是否有一种方法可以只检查我写的文本(而不是在我回复电子邮件时检查引用的文本)。由于我公司的安全设置,我无法添加加载项,因此需要依赖 VBA.
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
‘ Pops up a reminder if the word “attach” is found but there is no attachment on your email.
Dim m As Variant
Dim strBody As String
Dim intIn As Long
Dim intAttachCount As Integer, intStandardAttachCount As Integer
On Error GoTo handleError
‘Edit the following line if you have a signature on your email that includes images or other files. Make intStandardAttachCount equal the number of files in your signature.
intStandardAttachCount = 0
strBody = LCase(Item.Body)
intIn = InStr(1, strBody, “original message”)
If intIn = 0 Then intIn = Len(strBody)
intIn = InStr(1, Left(strBody, intIn), “attachment”)
intAttachCount = Item.Attachments.Count
If intIn > 0 And intAttachCount <= intStandardAttachCount Then
m = MsgBox(“It appears that you mean to send an attachment,” & vbCrLf & “but there is no attachment to this message.” & vbCrLf & vbCrLf & “Do you still want to send?”, vbQuestion + vbYesNo + vbMsgBoxSetForeground)
If m = vbNo Then Cancel = True
End If
handleError:
If Err.Number <> 0 Then
MsgBox “Outlook Attachment Reminder Error: ” & Err.Description, vbExclamation, “Outlook Attachment Reminder Error”
End If
前段时间这做了你想要的。
intIn = InStr(1, strBody, “original message”)
If intIn = 0 Then intIn = Len(strBody)
intIn = InStr(1, Left(strBody, intIn), “attachment”)
不再使用“原帖”来区分新旧
新的分隔符是"From: "
intIn = InStr(1, strBody, “From: ”)
我一直在 outlook 2010 中使用下面的代码来提醒我添加附件,如果我在电子邮件中引用了一个附件而忘记附加任何东西。但是,我想知道是否有一种方法可以只检查我写的文本(而不是在我回复电子邮件时检查引用的文本)。由于我公司的安全设置,我无法添加加载项,因此需要依赖 VBA.
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
‘ Pops up a reminder if the word “attach” is found but there is no attachment on your email.
Dim m As Variant
Dim strBody As String
Dim intIn As Long
Dim intAttachCount As Integer, intStandardAttachCount As Integer
On Error GoTo handleError
‘Edit the following line if you have a signature on your email that includes images or other files. Make intStandardAttachCount equal the number of files in your signature.
intStandardAttachCount = 0
strBody = LCase(Item.Body)
intIn = InStr(1, strBody, “original message”)
If intIn = 0 Then intIn = Len(strBody)
intIn = InStr(1, Left(strBody, intIn), “attachment”)
intAttachCount = Item.Attachments.Count
If intIn > 0 And intAttachCount <= intStandardAttachCount Then
m = MsgBox(“It appears that you mean to send an attachment,” & vbCrLf & “but there is no attachment to this message.” & vbCrLf & vbCrLf & “Do you still want to send?”, vbQuestion + vbYesNo + vbMsgBoxSetForeground)
If m = vbNo Then Cancel = True
End If
handleError:
If Err.Number <> 0 Then
MsgBox “Outlook Attachment Reminder Error: ” & Err.Description, vbExclamation, “Outlook Attachment Reminder Error”
End If
前段时间这做了你想要的。
intIn = InStr(1, strBody, “original message”)
If intIn = 0 Then intIn = Len(strBody)
intIn = InStr(1, Left(strBody, intIn), “attachment”)
不再使用“原帖”来区分新旧
新的分隔符是"From: "
intIn = InStr(1, strBody, “From: ”)