Nhờ trợ giúp Add-In để tránh quên gửi file Attach khi gửi Email Office Outlook. (1 người xem)

Liên hệ QC

Người dùng đang xem chủ đề này

hungvuong1009

Thành viên mới
Tham gia
12/3/12
Bài viết
1
Được thích
0
Chào mọi người.
Mình tham khảo được một đoạn Code để hạn chế việc quên gửi file đính kèm khi gửi Email có file đính kèm.
Đoạn code như sau:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim retMB As Variant
Dim strBody As String
Dim iIndex As Long

On Error GoTo handleError

iIndex = InStr(Item.Body, "file")
If iIndex > 0 And Item.Attachments.Count = 0 Then
retMB = MsgBox("You may have forgotten to attach a file." & vbCrLf & vbCrLf & "Do you still want to continue?", vbQuestion + vbYesNo + vbMsgBoxSetForeground)
If retMB = vbNo Then Cancel = True
End If

handleError:

If Err.Number <> 0 Then
MsgBox "Outlook Attachment Alert Error: " & Err.Description, vbExclamation, "Outlook Attachment Alertr Error"
End If

End Sub


Với đoạn code trên, mình mới chỉ kiểm tra được trong nội dung Email có từ "file", mình muốn thêm các từ khác nữa như là "attach", "attached",... thì phải làm thế nào.
Mong các bạn giúp đỡ. Cảm ơn mọi người.
 
thì thêm số biến vào ví dụ thế này:
sửa từ

iIndex = InStr(Item.Body, "file")
If iIndex > 0 And Item.Attachments.Count = 0

thành
iIndex = InStr(Item.Body, "file")
iIndex2 =InStr(Item.body, "attach")
If (iIndex > 0 or iIndex2 > 0) And Item.Attachments.Count = 0
 
Upvote 0
Web KT

Bài viết mới nhất

Back
Top Bottom