Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Help with VB6 + Outlook 2000


Message #1 by "Helio Junior" <junior_helio@h...> on Wed, 20 Dec 2000 11:23:38 -0000
This should get you started.  It's culled from a functioning application,
but not tested.

HTH,

-Roy

' ===============================
Option Explicit

Private m_nsMMS      As Outlook.NameSpace
Private m_appOutlook As Outlook.Application

Private Sub Form_Load()
  Set m_appOutlook = New Outlook.Application
  Set m_nsMMS = m_appOutlook.GetNamespace("MAPI")
End Sub

Private Sub CheckMail()
Dim fldInBox      As MAPIFolder
Dim itmIncoming   As Outlook.MailItem
Dim strContents   As String
Dim itmResponse   As Outlook.MailItem

   Set fldInBox = m_nsMMS.GetDefaultFolder(olFolderInbox)
   For Each itmIncoming In fldInBox.Items
      If itmIncoming.Class = olMail Then
         strContents = itmIncoming.Body
          If InStr(1, strContents, "search term") > 0 Then
            Set itmResponse = itmIncoming.Reply
            itmResponse.Body = "Got your message!"
            itmResponse.Send
         End If
      End If
      
   Next itmIncoming
   Set fldInBox = Nothing
   
End Sub
' ===============================

---
You are currently subscribed to pro_vb as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-pro_vb-$subst('Recip.MemberIDChar')@p2p.wrox.com

  Return to Index