[mso] Re: Outlook 2003, Distribution Lists and Categories

  • From: Thomas Hutchins <hutch99999@xxxxxxxxx>
  • To: mso@xxxxxxxxxxxxx
  • Date: Mon, 8 May 2006 14:32:55 -0700 (PDT)

The following macro creates an email, then pops up a category selection dialog. 
After you select one or more categories, it searches through your Outlook 
contacts. Every contact who has a category you selected is added to the 
recipient list.
   
  I'm sure someone who is more familiar than I with Outlook VBA can improve 
this considerably. Although I have done lots of VBA development in Excel & 
Access, I have never written a single macro for Outlook - until today. 
   
  Sub EmailFromCatg()
    Dim myOlApp As Outlook.Application
    Dim myMailItem As Outlook.MailItem
    Dim myNamespace As Outlook.NameSpace
    Dim myContacts As Outlook.Items
    Dim myItem As Outlook.ContactItem
    Dim SelCatg As String
'Creates an instance of the application
    Set myOlApp = Outlook.Application
'Creates appointment item
    Set myMailItem = myOlApp.CreateItem(olMailItem)
    myMailItem.Body = "Your Ad Here"
    myMailItem.Recipients.Add ("Thomas Hutchins")
    myMailItem.Subject = "TBD"
'Display the Show Categories dialog box
    myMailItem.ShowCategoriesDialog
    SelCatg$ = myMailItem.Categories
'Display the appointment
    myMailItem.Display
'Go through all my contacts. If any have the category(s) I just selected,
'add that person to the recipient list.
    Set myNamespace = myOlApp.GetNamespace("MAPI")
    Set myContacts = myNamespace.GetDefaultFolder(olFolderContacts).Items
    For Each myItem In myContacts
        If (myItem.Class = olContact) Then
            If InStr(SelCatg$, myItem.Categories) Then
                myMailItem.Recipients.Add (myItem.Email1Address)
            End If
        End If
    Next
End Sub
   
  Hope this is helpful,
   
  Hutch
  
"James S. Huggins (MSO)" <MicrosoftOffice@xxxxxxxxx> wrote:
  
I have a number of entries in my address book/contact list which share a
common "category".

I need to send an email to all of these people.

Is there a way to create a distribution list and then easily tell Outlook to
add all these people to that distribution list?


As a more general question ... 
If I open my contacts folder and then do a find category or other criteria, is
there an easy way add these people to a distribution list?

Or, is there an easy way to send them all an email WITHOUT adding them to a
distribution list?



James S. Huggins



... 

*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, visit the group's homepage and use the dropdown 
menu at the top. This will allow you to unsubscribe your email address or 
change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions. Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles

If you are using Outlook and you see a lot of unnecessary code in your email 
messages, read these instructions that explain why and how to fix it:
http://personal-computer-tutor.com/abc3/v28/greg28.htm
*************************************************************


                
---------------------------------
Love cheap thrills? Enjoy PC-to-Phone  calls to 30+ countries for just 2¢/min 
with Yahoo! Messenger with Voice.
                
---------------------------------
Love cheap thrills? Enjoy PC-to-Phone  calls to 30+ countries for just 2¢/min 
with Yahoo! Messenger with Voice.

*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, visit the group's homepage and use the dropdown 
menu at the top.  This will allow you to unsubscribe your email address or 
change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions.  Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles

If you are using Outlook and you see a lot of unnecessary code in your email 
messages, read these instructions that explain why and how to fix it:
http://personal-computer-tutor.com/abc3/v28/greg28.htm
*************************************************************

Other related posts: