Guest User

Untitled

a guest
Apr 20th, 2018
610
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. Dim MyOutlook As Outlook.Application
  2. Dim Msg As Outlook.MailItem
  3. Dim x As Namespace
  4. Dim Row As Integer
  5. Dim Path As String
  6. Dim FileList() As Variant
  7.  
  8. Set MyOutlook = New Outlook.Application
  9. Set x = MyOutlook.GetNamespace("MAPI")
  10. Set Msg = Nothing
  11.  
  12. MsgBox "Step1"
  13. Path = GetFolder()
  14.  
  15. If Path = "" Then
  16. MsgBox "No folder selected"
  17. Exit Function
  18. End If
  19.  
  20. MsgBox "Step2"
  21.  
  22. Path = Path + ""
  23. MsgBox Path
  24. FileList = GetFileList(Path + "*.msg")
  25. MsgBox "Step3"
  26.  
  27. Row = 1
  28. MsgBox "Step4"
  29. While Row <= UBound(FileList)
  30. MsgBox "Step5"
  31. Set Msg = x.OpenSharedItem(Path + FileList(Row))
  32. MsgBox "Step6" & Msg.Body
  33. Row = Row + 1
  34. MsgBox "Step7" & Msg.Body
  35.  
  36.  
  37. Wend
  38. MsgBox "Step8"
  39. MsgBox "file extrated=" + Msg.Body
  40.  
  41.  
  42. ExtractMsg = Msg
Add Comment
Please, Sign In to add comment