A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Reading Recipients in a folder



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old December 1st 09, 09:07 AM posted to microsoft.public.outlook.program_vba
Neil Perry
external usenet poster
 
Posts: 1
Default Reading Recipients in a folder

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(olFo lderInbox).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

  #2  
Old December 1st 09, 11:36 AM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP][_4_]
external usenet poster
 
Posts: 552
Default Reading Recipients in a folder

Recipients is a collection, not a string property:

Set recips = obj.Recipients
For Each recip in Recips
MsgBox recip.Address
Next

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Neil Perry" wrote in message
news
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(olFo lderInbox).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



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
group recipients and naming of sender - recipients nip Outlook - General Queries 10 September 4th 09 01:36 PM
OL 2003: Reading pane not available for DRAFTS folder Andrew Hamilton Outlook - General Queries 1 November 19th 08 05:30 AM
How can I send emails to multiple recipients & how many Recipients Cusie Outlook - Using Contacts 2 November 2nd 07 10:07 PM
Inbox Mail disappears after reading and leaving the folder! KILROY Outlook - Installation 3 January 15th 07 05:41 PM
how can i move a messeage to a certain folder before reading it? Bilal Outlook - Installation 1 February 22nd 06 12:24 PM


All times are GMT +1. The time now is 03:38 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.