Pradeep
thanks i am captureing information related with the subject "violation notification" to excel
but the subject has '"violation notification - "
i have the code
vb Code:
  1. Public Sub ReadOutlook()
  2.  
  3. Dim strString As String
  4. Dim MyArray() As String
  5. Dim olNamespace As Outlook.Namespace
  6. Dim olItem As MailItem
  7. Dim i As Integer
  8. Dim b As Integer
  9.  
  10. Dim olfolder As Outlook.MAPIFolder
  11. Dim lngCol As Long
  12. Dim mypasswrd
  13. Dim olMail As Variant
  14.  
  15. Set OL = GetObject(, "OUTLOOK.APPLICATION")
  16. Set MAPI = OL.GetNamespace("MAPI")
  17.  
  18. Set Folder = MAPI.Folders("Inbox")
  19. For Each Myitem In Folder.Items
  20. strString = "Violation Notication - "
  21. MyArray = Split(strString, "-")
  22. If Myitem = trim(MyArray(0) Then
  23. MsgBox (Myitem)
it does not pick up the "Violation Notication"