Consulting

Results 1 to 3 of 3

Thread: Extracting email addresses and path folder they are saved in

  1. #1
    VBAX Newbie
    Joined
    Jan 2019
    Posts
    2
    Location

    Extracting email addresses and path folder they are saved in

    Hello,

    I've been searching on the forum how to extract all email addresses in my outlook and the folder path they are saved in.
    I've found multiple solutions to extract the email addresses (VBA or applications) but I've never been able to extract the folder path.

    I'll explain, what I'm trying to do.
    We have a folder, full of subfolders with email form our clients and we would like to export the email addresses with the folder path where the message was found in a csv or something usefull.
    We found solutions to extract every emails addresses from each subfolders but there is never any indication of the folder they were found.
    Does anyone would have a solution?

    Thank you very much. (Sorry my english is not perfect)

  2. #2
    VBAX Mentor skatonni's Avatar
    Joined
    Jun 2006
    Posts
    347
    Location
    If you have the item you can work out the folder path.

    Option Explicit
    
        Sub GetItemsFolderPath()
    
        ' http://vboffice.net/sample.html?lang...5&cmd=showitem
        
        Dim obj As Object
        Dim F As Folder
        Dim Msg As String
        
        Set obj = ActiveWindow
        
        If TypeOf obj Is Inspector Then
            Set obj = obj.currentItem
        Else
            Set obj = obj.Selection(1)
        End If
        
        Set F = obj.Parent
        
        Msg = "The path is: " & F.FolderPath & vbCrLf
        Msg = Msg & "Switch to the folder?"
        
        If MsgBox(Msg, vbYesNo) = vbYes Then
            Set ActiveExplorer.CurrentFolder = F
        End If
        
    End Sub
    To debug, mouse-click anywhere in the code. Press F8 repeatedly to step through the code. http://www.cpearson.com/excel/DebuggingVBA.aspx

    If your problem has been solved in your thread, mark the thread "Solved" by going to the "Thread Tools" dropdown at the top of the thread. You might also consider rating the thread by going to the "Rate Thread" dropdown.

  3. #3
    VBAX Newbie
    Joined
    Jan 2019
    Posts
    2
    Location
    Thank you for your help.
    I've found a solution using the code on the page there: https://www.developpez.net/forums/bl...ls-vers-excel/
    Comments are in French, but it could be useful to others.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •