Tech Support Forum banner
Not open for further replies.
1 - 1 of 1 Posts

· Registered
1 Posts
Discussion Starter · #1 · (Edited)
Hi there

This is the first time I am posting in the forum. Greetings to all of the members.

Please help me to find a solution for the following.

I am using MS Outlook 2003 SP2. All that I need is to check if any attachment is attached to the email item before it is sent programmatically using macros. I tried to validate the presence of content in subject field before it is sent using following code in visual basic editor of outlook and I tried to cancel the mail if there is no content in the subject line using code.

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim strSubject As String
strSubject = Item.Subject
If Len(strSubject) = 0 Then
Prompt$ = "Subject is Empty. Are you sure you want to send the Mail?"
If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Check for Subject") = vbNo Then
Cancel = True
End If
End If
End Sub

This worked for few times but then after this doesn’t work. Please help me how to validate the presence of attachment in the mail item and to cancel if it doesn’t and also to check the subject content?

1 - 1 of 1 Posts
Not open for further replies.