Thanks for this logic.. i tried implementing this protocol... but i am not
able to trap the address at run time...
I have the following code embedded in the outlook session >> Can you please
help me in correcting if anything is not initialised / incorrect?
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
If TypeOf Item Is Outlook.MailItem Then
Cancel = Not SendBigMail(Item)
End If
End Sub
Private Function SendBigMail(oMail As Outlook.MailItem) As Boolean
Dim lSize As Long
Dim bSend As Boolean
Dim FileName As String
Dim TAtt As Long
Dim l As Long
Const MIN_SIZE As Long = 50000
oMail.Save
bSend = True
If oMail.SenderEmailAddress = "
[email protected]" Then
TAtt = oMail.Attachments.count
'Total number of attachments in my mail
If TAtt > 0 Then
l = 1
For l = 1 To TAtt
lSize = oMail.Size
If (Right(oMail.Attachments.Item(l).FileName, 3) = "mht") Or
(Right(oMail.Attachments.Item(l).FileName, 3) = "xls") Or
(Right(oMail.Attachments.Item(l).FileName, 3) = "pdf") Then
If lSize < MIN_SIZE Then
oMail.To = "Chitra Bhatia"
oMail.Subject = "Blank report Check " & oMail.Subject
' If its a blank attachment then send me a
notification mail
SendBigMail = bSend
Exit Function
End If
' Change the .mht file to xls before sending
If Right(oMail.Attachments.Item(l).FileName, 3) = "mht"
Then
FileName =
Replace(oMail.Attachments.Item(l).FileName, "mht", "xls", 1, 3)
oMail.Attachments.Item(l).SaveAsFile FileName
Set oMail.Attachments.Item(l) =
oMail.Attachments.Add(FileName, olByValue)
End If
End If
Next
For l = 1 To TAtt
If Right(oMail.Attachments.Item(l).FileName, 3) = "mht" Then
oMail.Attachments.Item(l).Delete
l = l - 1
End If
Next
End If
End If
SendBigMail = bSend
End Function