automatically check if attachment was added when sending message

  • Thread starter Thread starter kkappabear
  • Start date Start date
K

kkappabear

Hi,
I'm new to VBA and I'm trying to find some relevant links to this
topic. What I'm trying to do is that once user clicks on "send
message" the message will be scanned if it contains any attachments
and if not a popup will show up asking if he wants to add attachment
to the message.
So, what I need to know are informations about adding action to pre-
defined button in outlook, checking if attachment was added and then
regarding the answer on popup send the message or get back to
attachement addition.

Thank you for any help.

Marek Zacik
 
I've got no idea what was wrong, anyway it doesn't worked properly, so
I've wrote a simpler version:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As
Boolean)

Dim lngres As Long
If Item.Attachments.Count = 0 Then
lngres = MsgBox("No attachments, continue?", _
vbYesNo + vbDefaultButton2 + vbQuestion + vbSystemModal,
"Auto control...")
If lngres = vbNo Then Cancel = True
End If

End Sub

all works fine, but the popup shows in the main outlook window and
once I click to "No" I would like to switch the "New mail" window
back. Is it possible to toggle the new mail window after Cancel=True ?
 
Did you try this:

Set insp = Item.GetInspector
insp.Activate

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


I've got no idea what was wrong, anyway it doesn't worked properly, so
I've wrote a simpler version:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As
Boolean)

Dim lngres As Long
If Item.Attachments.Count = 0 Then
lngres = MsgBox("No attachments, continue?", _
vbYesNo + vbDefaultButton2 + vbQuestion + vbSystemModal,
"Auto control...")
If lngres = vbNo Then Cancel = True
End If

End Sub

all works fine, but the popup shows in the main outlook window and
once I click to "No" I would like to switch the "New mail" window
back. Is it possible to toggle the new mail window after Cancel=True ?
 
Back
Top