add to existing distribution list

Trying to add to an existing distribution list; (from MS Access to Outlook 
2003) ; code below can add, but always creates new DL (see below); skipping 
through Access records into general top level contacts was easy, DL work has 
been very frustrating.
Code below works (it adds to a list) but it needs to refer to a known list. 
How do I do this  successfully ?
I've played with :
         objDistList = 
myFolder.Items.Add(Outlook.OlItemType.olDistributionListItem)
in other code but get "object variable not set" even though I can see it has 
been !



Dim objOutlook As New Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objDistList As Outlook.DistListItem
Dim objMail As Outlook.MailItem
Dim objRecipients As Outlook.Recipients


Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set objDistList = objOutlook.CreateItem(olDistributionListItem)
Set objMail = objOutlook.CreateItem(olMailItem)
Set objRecipients = objMail.Recipients
 objDistList.DLName = InputBox("Enter name of Distribution List")
'objDistList.DLName = "test"



'For i = 1 To Cells(ActiveSheet.Rows.Count, 1).End(xlUp).Row
'objRecipients.Add (Range("C" & i).Value)
'Next i


objRecipients.Add "test3@t.com"
objRecipients.Add "test4@t.com"


objDistList.AddMembers objRecipients
'objDistList.Display
objDistList.Save
objRecipients.ResolveAll

Set objOutlook = Nothing
Set objNameSpace = Nothing
Set objDistList = Nothing
Set objMail = Nothing
Set objRecipients = Nothing

 


0
barret
1/5/2010 8:56:12 PM
outlook.program_vba 490 articles. 0 followers. Follow

3 Replies
1641 Views

Similar Articles

[PageSpeed] 57

You need to use the MAPIFolder.Items.Find method to return the existing list 
based on a query against some known criteria, such as the Subject (i.e. list 
name).
-- 
Sue Mosher, Outlook MVP
   Author of Microsoft Outlook 2007 Programming:
     Jumpstart for Power Users and Administrators
    http://www.outlookcode.com/article.aspx?id=54


"barret bonden" <support@networks-cc.com> wrote in message 
news:4b43a762$0$31272$607ed4bc@cv.net...
> Trying to add to an existing distribution list; (from MS Access to Outlook 
> 2003) ; code below can add, but always creates new DL (see below); 
> skipping through Access records into general top level contacts was easy, 
> DL work has been very frustrating.
> Code below works (it adds to a list) but it needs to refer to a known 
> list. How do I do this  successfully ?


0
Sue
1/5/2010 9:05:08 PM
  Ahhhh ! (sigh of relief)  the guardian angel of Outlook programmers is
still there. Ms. Mosher, I've been professionally programming in VB/VBA for
16 + (?) years now , but still can't make substantial  heads or tails of
Outlook syntax; I have no real capacity to be creative here.

  This is crass of me, but could you be more explicit ? Or direct me to some
code (been looking for weeks) that solves this ?




"Sue Mosher [MVP]" <suemvp@gmail.com> wrote in message 
news:e9XoGrkjKHA.1536@TK2MSFTNGP06.phx.gbl...
> You need to use the MAPIFolder.Items.Find method to return the existing 
> list based on a query against some known criteria, such as the Subject 
> (i.e. list name).
> -- 
> Sue Mosher, Outlook MVP
>   Author of Microsoft Outlook 2007 Programming:
>     Jumpstart for Power Users and Administrators
>    http://www.outlookcode.com/article.aspx?id=54
>
>
> "barret bonden" <support@networks-cc.com> wrote in message 
> news:4b43a762$0$31272$607ed4bc@cv.net...
>> Trying to add to an existing distribution list; (from MS Access to 
>> Outlook 2003) ; code below can add, but always creates new DL (see 
>> below); skipping through Access records into general top level contacts 
>> was easy, DL work has been very frustrating.
>> Code below works (it adds to a list) but it needs to refer to a known 
>> list. How do I do this  successfully ?
>
> 


0
barret
1/5/2010 10:38:00 PM
There's nothing special about Outlook syntax. It's all objects, properties,
methods, and events, the same as with other libraries you may have used in
VB/VBA. The method you need, Items.Find, is well documented in Outlook VBA
Help and in the Outlook Developer Reference on MSDN.
-- 
Sue Mosher, Outlook MVP
   Author of Microsoft Outlook 2007 Programming:
     Jumpstart for Power Users and Administrators
    http://www.outlookcode.com/article.aspx?id=54


"barret bonden" <support@networks-cc.com> wrote in message
news:4b43bf48$0$5015$607ed4bc@cv.net...
>
>  Ahhhh ! (sigh of relief)  the guardian angel of Outlook programmers is
> still there. Ms. Mosher, I've been professionally programming in VB/VBA
> for
> 16 + (?) years now , but still can't make substantial  heads or tails of
> Outlook syntax; I have no real capacity to be creative here.
>
>  This is crass of me, but could you be more explicit ? Or direct me to
> some
> code (been looking for weeks) that solves this ?
>
>
>
>
> "Sue Mosher [MVP]" <suemvp@gmail.com> wrote in message
> news:e9XoGrkjKHA.1536@TK2MSFTNGP06.phx.gbl...
>> You need to use the MAPIFolder.Items.Find method to return the existing
>> list based on a query against some known criteria, such as the Subject
>> (i.e. list name).
>>
>> "barret bonden" <support@networks-cc.com> wrote in message
>> news:4b43a762$0$31272$607ed4bc@cv.net...
>>> Trying to add to an existing distribution list; (from MS Access to
>>> Outlook 2003) ; code below can add, but always creates new DL (see
>>> below); skipping through Access records into general top level contacts
>>> was easy, DL work has been very frustrating.
>>> Code below works (it adds to a list) but it needs to refer to a known
>>> list. How do I do this  successfully ?
>>
>>
>
>



0
Sue
1/6/2010 1:07:12 AM
Reply:

Similar Artilces:

Creating a Microsoft Words document from an existing Excel spreads
Hi all, I need your kind guidance on how to create a new microsoft words document using an existing excel spreadsheet? At present, I have an excel spreadsheet, say "data.xls" containing data for example 6 fields such as COMPANY NAME, DATE, ITEM1, ITEM2, ITEM,3 & QUOTATION TOTAL. Under these 6 fields are some records of my customers. COMPANY NM DATE ITEM1 ITEM2 ITEM3 QUOTATION TTL ---------------- ------- -------- ------- -------- ------------------- ABC Limited 3 Apr xxxxx xxxxx ...

Smart List problem
I recently re-installed a client (version 9.0). Everything went fine but when we tried to open Smartlist on this client we got an error message telling us that “To use Smartlist capability in this product the Smartlist tables must be built. This is one time initialization process and may take a few minutes”. I answered yes, it ran and then returned the following error “number of columns does not match table definitions”. Every other machine is working fine, is the tables it is talking about building on the client? It does not seem like that should be so. It does not matter ...

Cloning a price list
Is there any way either through the standard user interface or through the CRM SDK to clone an entire price list? TIA Not an option under standard UI Need to use SDK. Good luck. Frank Lee Workopia, Inc. http://www.workopia.com/Links.htm San Francisco, CA "JB" wrote: > Is there any way either through the standard user interface or through > the CRM SDK to clone an entire price list? > > TIA > > ...

Project accounting info for vendor does not exist on version 9
We have 15 companies, of which only ONE company uses project accounting. User ID does NOT have access to the alternate POP window to show project information. Why are we receiving the error that the vendor does not have PA info setup, when we are not using PA in this company? How do we shut this off for window that is not showing PA? As well in the company that will be using PA, if the PA info does NOT show on the window, we are entering regular POs therefore we do NOT want any PA info for the vendor. ...

custom address list for EXTERNAL email addresses
I know it is possible to create a custom address list in Exchange 2003 for internal use but how about for external email addresses outside of a company? Is this possible?? Any help would be appreciated. Thanks in advance. Create contacts for each of the external mail addresses and add them to the distribution list. If add a valid internet email address to the distribution list external people can also send to it. Glen "Steven Peters" <Steven Peters@discussions.microsoft.com> wrote in message news:CBF2F2AE-ABF4-491C-836C-59611375F9F1@microsoft.com... > I know it is pos...

Does a 'grace period' exist for Server CALs??
I am presently planning a new Win2k8 R2 DC/TS/AD/DNS server install. I know the TS/RDS CALs have a "grace period" which allows me time to obtain however many additional CALs we need. Does a similar "grace period" exist for the Server CALs per se?? If I don't have enough Server CALs (device) at the time of setting up the server and people's computers connecting to it via Terminal Services/Citrix, what will happen?? I haven't found anything searching the Internet... Thank you, Tom Hello tom12010, See here about the grace periods depending ...

Comparing first and last names in two lists
I have two data sources that each contain about 8000 names in seperate fields for first and last name. I can put them on seperate worksheets or append one to the other. I need to make them match and find out where they don't. Messed with consolidate but not sure if that will work for more than one column at a time. FYI data set one is from a school transportation database and data set two is from the main student database from the same school district. ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages dir...

List control selction and deselection
For selecting an item from a CListCtrl just call mList.SetItemState(iItem,LVIS_SELECTED | LVIS_FOCUSED, 0xFF) during Initialization For deslecting we need to insert item once again, ie mList.DeleteAllItems() mList.InsertItem() i know this is not a good method, but i didnt get any other options. if anyone know, pls let me know!!! Regards "johnWins" <johnsvakel@gmail.com> wrote in message news:2ccf2c5c-eb5c-46fd-9bd5-30d89d2048f6@v67g2000hse.googlegroups.com... > For selecting an item from a CListCtrl just call > > mList.SetItemState(iItem,LVIS_SELECTED | LV...

List Running Horizontally-Pivot Table Possible?
I just had a customer ask this one and I'm not so sure about it. 1) The customer has setup a list of information that is running horizontally instead of the typical list running vertically. 2) I just taught him how to do pivot tables and he wants to generate a pivot table with his "horizontal" list. 3) I know he can copy and paste special and use the Transpose feature to change the list from horizontally oriented to vertically oriented. 4) the question is: can he leave the table in its original orientation and still generate Pivot tables? I can't seem to make it work ...

How do I add certificates for digital signatures
I'm trying to follow the directions at http://office.microsoft.com/en-us/help/HP052495571033.aspx and when I get to the step where I'm supposed to choose a certificate, the list is empty. Where is it looking? How do I add a certificate? On Fri, 13 Nov 2009 10:47:39 -0800 (PST), Chris Nelson <chris.nelson.1022@gmail.com> wrote: >I'm trying to follow the directions at http://office.microsoft.com/en-us/help/HP052495571033.aspx >and when I get to the step where I'm supposed to choose a certificate, >the list is empty. Where is it looking? How do I add a...

Category to Distribution List
Dear All: A: Outlook 2003 B: OS = XP Is there a way to create a Distribution List from a category ? I have a number of clients in special categories ( usually company name) However, there are times when I want to send BCC to several clients and would like to find a way to send that email without having to insert all the names. The category list of names can only be in the To: portion of the outgoing email. Suggestions highly appreciated. John A Hansen Two methods, both starting with the folder grouped by category, and all = the items in the category selected:=20 1) Choose Actions |...

Stop use of Distribution List
Is there anyway that you can stop, or restrict the use of a distribution list? Since you have so much detail of how you are setup and if there are specific people or groups you want to restrict from using it, I will answer your question with the same amount of detail....YES. Add more detail and we can give you a better answer. "brendanrtw" <brendanrtw@discussions.microsoft.com> wrote in message news:6CB3EB2F-F428-46AD-A41E-A1495B8CF4CD@microsoft.com... > Is there anyway that you can stop, or restrict the use of a distribution > list? On Thu, 3 Nov 2005 12:00:...

How can I parse or Loop a list based on single field to Googlemaps
This is some code that will parse each sequential field [Point_#) into a list for googlemaps. [Form_Runs].WebRouteMap.navigate "http://maps.google.co.uk/maps?f=q&hl=en&q=" & "from: " & Me.Point_1 & (" to: " + Me.Point_2) & (" to: " + Me.Point_3) The table/form is laid outlike this: [Route_No] [Point_1] [Point_2] [Point_2] 5 North St, N1 East St, N3 High Road, W6 And the code will give this style of parsed list: from: North St, N1 to: East St, N3 to: High Road, W6 That works just ...

selecting multiple choices from a drop down list
I have a drop down list in a cell and I want to be able to selec multiple entries from that list. Does anyone know how I go this -- Message posted from http://www.ExcelForum.com If this is a data validation list, you could use code to compile a list of selected items. For example, if the data validation is in column C, the following code will store the selected items in the same row in column D: '============================= Private Sub Worksheet_Change(ByVal Target As Range) Dim rngDV As Range Application.EnableEvents = False If Target.Count > 1 Then Exit Sub On Error Resume N...

Delegates cannot add contacts?
I've created an OU for external email addresses, shared across the company. Within that OU, I've created a nested OU for specific delegation. I've delegated management of the OU to a specific contract manager. My dilemma? From what I've been able to determine, no one except an Exchange admin can create new contacts. Ideas/suggestions? I've installed the Exchange admin/management tools on the appropriate systems. TIA, Mike Mike Is the problem that you have delegated permissions within AD and are no experiencing problems? Nue "Mike" <newsgroups@manco...

Unable to add documents to My Recent Documents
Hello, Any suggestions as to how to fix "My Recent Documents"? No new documents add to the folder and it remains persistently empty. I get an "Access denied" message when attempting to go to customizing the Start menu advanced tab. Are you Right-Clicking on the Start Button and then selecting Properties from the list? If you select Properties then You need to select Customize from Start Menu Tab. Then from Advanced Tab you should ensure there is a TICK next to "List my Most Recently Opened Documents". hth Gary V wrote: > > Hello, &g...

CRM 3.0 Setup err databases already exist on the specified SQL Ser
ReportServer ReportServerTempDB Question : How to clear this problem? The On-Line Help did not applied as SQL 2005 has been installed on SBS2003 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Microsoft SQL Server Reporting Services Cause There are two causes for this error: Microsoft SQL Server Reporting Services is already installed on the specified server. Setup has found a version of Microsoft SQL Server that is not supported by Microsoft SQL Server Reporting Services. Solution One of the following versions of Microsoft SQL Server are required for Microsoft SQL Server Repor...

List folders to file
Hi Does anyone have a macro that would list all the folders (with path) and subfolders to an excel sheet but not the files? Thanks Shona Shona- There's a function called CELL() that should return your filename (or any of a number of parameters) but I can't get it to work properly on my machine, so I can't make it work for you. The syntax is =CELL("filename") which ought to return the path and filename of the current file, and which you could then trim down to show just the path. Can anyone provide some guidance here? Dave, If it isn't working for you, it pro...

Combo
Hi, I am able to create a list of items with a drop down menu. I can select specific item but how do I select all item to get a query output. Your help would be much appreciated. Thanks You can't select multiple items from an Access combo box. To do that would require a listbox with it's MULTI-SELECT property set to SIMPLE or EXTENDED. See more info about list boxes here: http://www.fontstuff.com/access/acctut11.htm -- Bob Larson Access World Forums Super Moderator Utter Access VIP Tutorials at http://www.btabdevelopment.com __________________________________ If my post ...

Making words in a list a value!!
I am trying to create a list that will generate a value in another column once that word or phrase is chosen. Is this possible and how. Exp. In the drop down list I would chose Product, then in the price column the price automatically appears. brco1, Much better than I could ever explain the process. Here's exactly wha you need. http://www.contextures.com/xlFunctions02.html HT -- Case ----------------------------------------------------------------------- Casey's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=454 View this thread: http://www.excelforu...

Disable people picker in a sharepoint list
Dear all, I would like to disable the users/groups picker field in a SharePoint list (NewForm.aspx). I managed to disable the field itself (text box) but it's still possible to click on the "Browse" button and search for people that then get eneterd in the field. Is there a way to disable the browsing? Thank you in advance, Hrvoje I think you will delete that column. 1. Settings>List settings>Click you wnat column name on Colums category. 2. Click "delete" button. And then you can make other column. "Hrvoje" wrote: > ...

Combining Lists within excel.
I'm hoping someone can help here. I'll try to explain the problem I have. I have 2 worksheets both containing a product list. I have entries on one worksheet which I need on the other, so basically my question is... might there be a way of combining these two lists so one updates the other with the missing entries. Help on this would be great, as they are very large lists which I dont much fancy the thought of looking through them manually. Are you familiar with the VLOOKUP function? I use it all the time for this type of problem. vlookup(Product cell in first sheet, Array...

List Box Point-to-Select (MouseMove)
I have a list box that shows files from my hard drive. I'd really like to have it select the item being pointed to as I move my mouse pointer over it. I have coded this and it works fine unless the list is scrolled. I need a way to offset my list index to account for how far down the list has been scrolled. I can't find a list box property that will allow me to determine where a scrolled list is positioned. Something giving me the list index of the first visible row would do the trick. I haven't been able to find anything so far. I've tried some VB code that uses the Send...

add GENDERCODE to leads
We implemented MS CRM some time ago, and now we come across some minor issues... one of them is: why can't we add the GENDERCODE to a lead?? is there a way to do it (easily) or can we better forget about it??? ...

Rule to automatically mark header to download based on contact list?
Is there a way to do this, or an add-in? TIA. Rich On Tue, 26 Apr 2005 04:44:35 -1000, rmc <rmc@nospam.com> wrote: > Is there a way to do this, or an add-in? What version of Outlook are you using? -- -Ben- Ben M. Schorr, MVP Hi Ben: 2003 SP1 Rich "Ben M. Schorr - MVP" <bens@bogusaddress.mvp> wrote in message news:op.spuxh8sf6r4cx1@bms-tablet2.scgab.com... > On Tue, 26 Apr 2005 04:44:35 -1000, rmc <rmc@nospam.com> wrote: > > > Is there a way to do this, or an add-in? > > What version of Outlook are you using? > > > -- >...