Extract email addresses from user a created gmail folder

I have access via Outlook 2013 as well as online.  I need a way to extract all email addresses found in a particular Gmail folder.

Assistance in finding a free option that does NOT allow for someone to harvest my email addresses is greatly appreciated.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You can use Outlook VBA to go through all the messages in a folder. Is the gmail folder already in your Outlook?
frugalmuleAuthor Commented:
Can you post a specific solution?
Yes, but it's easier if you answer the question. Gmail already in Outlook? Is it a PST file, or a IMAP folder?
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

frugalmuleAuthor Commented:
Imap folder that I created for filtering
frugalmuleAuthor Commented:
I have access from outlook or web
Here's some code to get it into Excel (where you can use the Remove Duplicates function later).
It works by first selecting the folder. Then everything is automatic (computer might freeze for several minutes, depending on the amount of messages).

Sub pickfolder()

Dim NS As Outlook.NameSpace
   Set NS = Application.GetNamespace("MAPI")
Set pickedfolder = NS.pickfolder

Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True

Set xlBook = xlApp.Workbooks.Add

Set xlSheet = xlBook.Worksheets("Sheet1")

counter = 1
For Each Item In pickedfolder.Items
    If Item.SenderEmailType = "SMTP" Then
        xlSheet.Cells(counter, 1).Value = Item.SenderEmailAddress
        counter = counter + 1
    End If

End Sub

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
frugalmuleAuthor Commented:
Thanks for your code.  Here are the steps I took to use it.  No luck so far.

Sorry I wasn't clear. The code is for Outlook (again use ALT+F11, use the code in ThisOutlookSession). No need to open Excel (it opens by itself).
frugalmuleAuthor Commented:
Ok, getting closer.  I input the code into outlook.

1) How do I run it?
2) How do I tell what the final count is for messages in that folder?  I want to make sure before I run the macro that the total number of messages in that imap folder have been downloaded.  I can see that number in Gmail from the website, but not from within Outlook.

Thank you again for your help.  Please advise further.
frugalmuleAuthor Commented:
I do not see how to run the code in Outlook 2013
This code can be run, when you are with your cursor in the code, with F5. Or anywhere else in Outlook with ALT+F8.
If you can't see all the emails  in your Outlook folder, it's already a wrong start. It's meant to be run on a folder where you can already see all the emails (and the messages you click on open immediately).
If that's not the case, create a local pst file, and copy all the Gmail messages there first, then run the code and select that local folder.
frugalmuleAuthor Commented:
I'm lost.  This site needs a chat feature.
Tell exactly what you did and what happened?
Did you copy & paste the code in the VB Editior (ALT+F11) in Outlook then F5 (after you click somewhere in the code, so the cursor is blinking within that code)? Do you get the screen to browse to a folder. What happens after you click on the folder?
frugalmuleAuthor Commented:
Got it.  Is it extracting from body and cc also?
No, that requires a lot more coding. If you really need it, I can do that later.
frugalmuleAuthor Commented:
Great stuff, thank you.

If there is anything you can do to make it extract from CC and from the body would be greatly appreciated  http://www.codeshare.io/VLR1a
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Email Clients

From novice to tech pro — start learning today.