Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a way to detect a send event from outlook? 1

Status
Not open for further replies.

datenis

Programmer
Jan 22, 2002
98
CA
Is there a way for VB to detect an event when the client clicks send on an outlook message, and then return information such as From, To, CC:, Body etc?

thx,

-d
 
I know 2 methods to catch the outlook events:
1. Create VB add in
2. You can use custom rules(but it is quite a difficult code and very non friendly but possible)

Hope it help you.
 
Er...for simple stufff such as catching an email being sent you don't need to do an add-in or a custom rule...
Code:
Option Explicit
Private WithEvents myOutlook As Outlook.Application

Private Sub Form_Load()
    Set myOutlook = GetObject(, "outlook.application")
End Sub

Private Sub myOutlook_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Dim myMailItem As MailItem
    Dim myRecip As Recipient
    
    Set myMailItem = Item
    With myMailItem
        Debug.Print .To
        Debug.Print .CC
        Debug.Print .Subject
        Debug.Print .Body
    End With
End Sub
 
Exactly what I was looking for

StrongM thanks dude!

-d
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top