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

get value from contacts folder



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 13th 08, 03:04 PM posted to microsoft.public.outlook.program_vba
Pippo
external usenet poster
 
Posts: 2
Default get value from contacts folder

hy

this is a simple code to send mail ....

Sub InviaEmail()
Dim AppOut As Outlook.Application
Set AppOut = New Outlook.Application
Set NewMail = AppOut.CreateItem(olMailItem)

NewMail.To =
NewMail.CC =

NewMail.BCC =


NewMail.Subject = "blabla"
NewMail.Body = " blabla"
NewMail.Attachments.Add "C:\myfile.txt"
' NewMail.Send
NewMail.Display
End Sub

....but i need to get the "NewMail.To" value directly from my contacts
folder. ( i've a group list named "clientii" with 100/120 members that
sometimes can change and it would be a very boring job to write all the
names to hand or to cancel them and rewrite when they change)


tanks


  #2  
Old March 13th 08, 05:30 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default get value from contacts folder

Read the ContactItem.Email1Address property from the contact.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Pippo" wrote in message
...
hy

this is a simple code to send mail ....

Sub InviaEmail()
Dim AppOut As Outlook.Application
Set AppOut = New Outlook.Application
Set NewMail = AppOut.CreateItem(olMailItem)

NewMail.To =
NewMail.CC =

NewMail.BCC =


NewMail.Subject = "blabla"
NewMail.Body = " blabla"
NewMail.Attachments.Add "C:\myfile.txt"
' NewMail.Send
NewMail.Display
End Sub

...but i need to get the "NewMail.To" value directly from my contacts
folder. ( i've a group list named "clientii" with 100/120 members that
sometimes can change and it would be a very boring job to write all the
names to hand or to cancel them and rewrite when they change)


tanks



  #3  
Old March 17th 08, 12:06 PM posted to microsoft.public.outlook.program_vba
Pippo
external usenet poster
 
Posts: 2
Default get value from contacts folder


"Dmitry Streblechenko" ha scritto nel messaggio
...
Read the ContactItem.Email1Address property from the contact.

...
hy
i've done it

http://msdn2.microsoft.com/en-us/library/bb220057.aspx
"Returns or sets a String representing the e-mail address of the first
e-mail entry for the contact."

....but i don't know how to use it in my code...

NewMail.To =
NewMail.CC =

NewMail.BCC =


i would be able to write in "NewMail.To=" directly the distribution list
name stored in my contacts folder (NewMail.To="Clienti" or
NewMail.to="query" and not ;
;
; ecc ecc"

i don't need to change the DL

....manually from outlook adress book interface i can add and remove members
from the distribution list as i need

tanks



  #4  
Old March 17th 08, 05:12 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default get value from contacts folder

If the DL comes from one of the contacts folders that are used by the
automatic name resolution (such as the default Contacts folder), you can
just set the MailItem.To property to the name DL. The DL name will be
resolved when you call MailItem.Recipients.ResolveAll or when teh mesage is
sent.
Otherwise you can either set the To property to a ";" separated list of DL
member addresses (loop through the DistListItem.Members collection) or call
MailItem.Recipients.Add for each DL member address.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Pippo" wrote in message
...

"Dmitry Streblechenko" ha scritto nel messaggio
...
Read the ContactItem.Email1Address property from the contact.

..
hy
i've done it

http://msdn2.microsoft.com/en-us/library/bb220057.aspx
"Returns or sets a String representing the e-mail address of the first
e-mail entry for the contact."

...but i don't know how to use it in my code...

NewMail.To =
NewMail.CC =

NewMail.BCC =


i would be able to write in "NewMail.To=" directly the distribution list
name stored in my contacts folder (NewMail.To="Clienti" or
NewMail.to="query" and not ;
;
; ecc ecc"

i don't need to change the DL

...manually from outlook adress book interface i can add and remove
members from the distribution list as i need

tanks





 




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
Deleting Contacts Folder in Folder List cavasta Outlook - Using Contacts 4 January 8th 08 04:47 PM
Contacts - Cannot display Folder. The folder is full. Nanna Vikki Outlook - Using Contacts 6 November 26th 07 06:51 AM
How to Sync Public Folder Contacts with Personal Folder Contact Li Larz Outlook - Using Contacts 0 May 14th 07 07:22 PM
Can I link public folder contacts to the My Contacts folder? phil Outlook - Using Contacts 1 March 30th 07 03:18 AM
Notes should retain when updating contacts from folder to folder Jason Chapman Outlook - Using Contacts 0 April 12th 06 04:11 AM


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.