Reading Recipients in a folder

  • Thread starter Thread starter Neil Perry
  • Start date Start date
Status
Not open for further replies.
N

Neil Perry

Hi -

I am trying to extract all of the email addresses I have sent emails to in a

folder to a text file. So far I have been able to extract the email address

of the person who sent the email (i.e. me) using the SenderEmailAddress

property, but when I try to use the Recipients property, I get the error

"Run-time error '438': Object doesn't support this property or method."

The code I am using is:

Sub SetFlagIcon()

Dim myOlApp As Outlook.Application

Dim mpfInbox As Outlook.MAPIFolder

Dim obj As Outlook.MailItem

Dim i As Integer

Dim s As String

Dim sendername1 As String

Dim response As Integer

Set myOlApp = CreateObject("Outlook.Application")

Set mpfInbox =

myOlApp.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Folders("Test")

' Loop all items in the Inbox\Test Folder

For i = 1 To mpfInbox.Items.Count

If mpfInbox.Items(i).Class = olMail Then

Set obj = mpfInbox.Items.Item(i)

s = obj.SenderEmailAddress

's = obj.Recipients

obj.Save

MyFile = "c:\nperry4\" & "nperry4.txt"

fnum = FreeFile()

Open MyFile For Append As fnum

Print #fnum, s

Close #fnum

End If

Next

End Sub

I have commented out the recipients line while I figure it out.

Many thanks for any response.

Neil
 
Recipients is a collection, not a string property:

Set recips = obj.Recipients

For Each recip in Recips

MsgBox recip.Address

Next

Sue Mosher

"Neil Perry" <NeilPerry> wrote in message

news:DC7BB71D-F995-45D4-9796-1E85CA79DDF2@microsoft.com...
> Hi -

> I am trying to extract all of the email addresses I have sent emails to in
> a
> folder to a text file. So far I have been able to extract the email
> address
> of the person who sent the email (i.e. me) using the SenderEmailAddress
> property, but when I try to use the Recipients property, I get the error
> "Run-time error '438': Object doesn't support this property or method."

> The code I am using is:

> Sub SetFlagIcon()
> Dim myOlApp As Outlook.Application
> Dim mpfInbox As Outlook.MAPIFolder
> Dim obj As Outlook.MailItem
> Dim i As Integer
> Dim s As String
> Dim sendername1 As String
> Dim response As Integer

> Set myOlApp = CreateObject("Outlook.Application")
> Set mpfInbox =
> myOlApp.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Folders("Test")
> ' Loop all items in the Inbox\Test Folder
> For i = 1 To mpfInbox.Items.Count
> If mpfInbox.Items(i).Class = olMail Then
> Set obj = mpfInbox.Items.Item(i)
> s = obj.SenderEmailAddress
> 's = obj.Recipients
> obj.Save
> MyFile = "c:\nperry4\" & "nperry4.txt"
> fnum = FreeFile()
> Open MyFile For Append As fnum
> Print #fnum, s
> Close #fnum
> End If
> Next
> End Sub

> I have commented out the recipients line while I figure it out.

> Many thanks for any response.
> Neil
>
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
Z Automatically adjust Outlook Reading Pane from bottom to right depending on portrait or landscape window Using Outlook 1
H Preventing the 'email address fetch from Exchange' crashing email reading code Exchange Server Administration 0
J Split reading view with history Using Outlook 2
D Outlook launch email showing new unread email in reading pane Using Outlook 11
W Outlook 2010 Reading Pane Slows Startup Using Outlook 3
C Custom Form (seperate layout pages and message reading pane) Outlook VBA and Custom Forms 0
C Reading Pane for Custom Form Outlook VBA and Custom Forms 2
llama_thumper Composingemails in reading pane Using Outlook 1
O Reading Pane safety Using Outlook 0
P Reading Pane (Reading Pain?) Default Setting Using Outlook 1
U Outbox Message Stuck after reading some MailItem Properties with VBA Outlook VBA and Custom Forms 1
M Outlook 2016 bottom reading pane has disappeared Using Outlook 2
M Outlook 2016: Changing default font for Notes and Reading Pane Using Outlook 4
Rupert Dragwater "there was an error reading this theme" Using Outlook 3
R Toggle the Reading Pane using Keyboard Shortcut Using Outlook 0
T Format Reading Pane Outlook VBA and Custom Forms 5
B Auto Preview Attachment in Inspector Reading Pane Outlook VBA and Custom Forms 1
D Calendar view problems with reading pane open Using Outlook 0
E Reading Pane has disappeared Using Outlook 1
R Outlook 2010 - Reading Pane and To Do Bar Settings Not Saved on Exit Using Outlook 2
Diane Poremsky Excel Files Won't Display in Reading Pane Using Outlook 1
S How can I Customize Message Header in both Reading Pane and Open Message Design? Using Outlook 1
M Outlook 2007: how to narrow the reading pane and the composing pane Using Outlook 0
P Custom Forms in Reading/Viewing Pane Using Outlook 1
L Reading Pane - COMPLETELY DISABLE? Using Outlook 10
T Outgoing Messages in the Reading Pane Cannot Be Flagged in Outlook 2013 Using Outlook 6
F Outlook 2007 - Reading Pane Automatically Downloads First/Topmost Message Using Outlook 4
B Outlook 2010 won't save 'current view' with reading pane at 'bottom' Using Outlook 4
F Outlook 2010, reading pane, global settting for fields? Using Outlook 1
V Reading/Posting in Newsgroups Using Outlook 1
C Contact photos not showing in reading pane in Outlook 2013 Using Outlook 3
T Killing reading pane - "globally" Using Outlook 11
L Show all images for jpg attachments in reading pane for received emails? Using Outlook 3
A Received Date None after reading Using Outlook 2
M Viewing Custom Form Fields in the Reading Pane and in Replies Using Outlook 3
B Reading CompressedRichText field in SQL database BCM (Business Contact Manager) 1
R Proof Of Looping Bug in Reading Outlook Inbox From Access? Outlook VBA and Custom Forms 2
L Reading another mailbox Address Outlook VBA and Custom Forms 2
S Macro for Viewing mails one after the other in the Reading Pane Outlook VBA and Custom Forms 2
E CustomTaskPane in PLace of Reading Pane Outlook VBA and Custom Forms 3
E CustomTaskPane in PLace of Reading Pane Outlook VBA and Custom Forms 3
J Reading outlook conatcts Outlook VBA and Custom Forms 1
D Getting Started - Reading attachment Outlook VBA and Custom Forms 4
J Reading E-Mails in VBA Outlook VBA and Custom Forms 1
T Blank Email in Reading Pane for Custom Form Outlook VBA and Custom Forms 12
S Reading mailitem after mail is send give runtime error. Outlook VBA and Custom Forms 1
C Getting reading pane horizontal instead of vertical Using Outlook 2
Y View Reading Pane for Drafts folder Using Outlook 2
M USING INITIALS AS RECIPIENTS Using Outlook 1
J Outlook Autocomplete (Recipients) opens upward Using Outlook 2

Similar threads

Back
Top