View Full Version : Solved: Save email address to txt or xls
polako89
04-23-2013, 07:11 AM
Hello!
i need a macro or a rule that take the email address from all emails on a folder and whrite those address to a file, txt, xls or doc.
can anyone help me please?!
thank you!
mdmackillop
04-23-2013, 04:19 PM
This can be run from Excel
Sub GetAddresses()
Dim wsSheet As Worksheet
Dim olApp As Outlook.Application
Dim olNamespace As Outlook.Namespace
Dim olFolder As Outlook.MAPIFolder
Dim olItems As Outlook.Items
Dim olItem As Object
Set wsSheet = ActiveSheet
Set olApp = New Outlook.Application
Set olNamespace = olApp.GetNamespace("MAPI")
'Find folder constants
On Error Resume Next
For i = 1 To 50
Cells(i, 5) = i & " - " & olNamespace.GetDefaultFolder(i)
Next
On Error GoTo 0
'Set folder here @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Set olFolder = olNamespace.GetDefaultFolder(6)
Set olItems = olFolder.Items
On Error Resume Next
i = 0
For Each olItem In olItems
i = i + 1
Cells(i, 1) = olItem.Sender
Cells(i, 2) = olItem.Sender.Address
Next
On Error GoTo 0
Exit Sub
'Null out the variables.
Set olItem = Nothing
Set olConItems = Nothing
Set olFolder = Nothing
Set olNamespace = Nothing
Set olApp = Nothing
End Sub
polako89
04-23-2013, 05:08 PM
Thank you very much!
i`m trying to configure the folder name that is "Lixo Eletrônico" but is not working, what can i doing wrong?
polako89
04-23-2013, 07:30 PM
i did it work!
Thank you very much!
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.