Re: Outlook Automation Problem
- From: "Alastair MacFarlane" <anonymous@xxxxxxxxxxxxx>
- Date: Sun, 23 Oct 2005 20:43:27 +0100
Norm
As you can see from the previous routine, I am not that good with Outlook
VBA. Have you tried posting this on the Outlook VBA site? They may have more
of an idea. I don't have Outlook on this pc so I don't have the object model
on this pc to check. Perhaps others in this group have access to it. I will
check progress on your post tomorrow where I will be at a pc that has
Outlook on it.
Sorry that I couldn't be more help at the moment. Are you taliking about the
display name that changes or that the physical email address changes?
Alastair
"Norm" <nofo@xxxxxxxxxxx> wrote in message
news:SNQ6f.13701$MN6.10712@xxxxxxxxxxxxx
> Alastair,
>
> When I was working at a company that used Outlook and an Exchange server,
> the error was usually caused by the IT department entering the users name
> wrong. The few times I had this error it drove me nuts until I checked the
> name on the server and found it had been entered with a space after the
> name. So when you used the correct users name in the email you still got
> an error, because yours did not have a space after then name.
>
> Not being that familiar with Outlook I am really having trouble
> understanding how to trap for this error, short of sending individual
> emails.
>
> Norm
> "Alastair MacFarlane" <anonymous@xxxxxxxxxxxxx> wrote in message
> news:eNii95$1FHA.3560@xxxxxxxxxxxxxxxxxxxxxxx
>> Norm
>>
>> Why not use a Distribution List and then send to all members of the
>> distribution list and then you won't need to loop through all the members
>> individually. I have used this method before. I have attached a rather
>> crude sub and ignore some of the code as I have not had a chance to edit
>> it for this post:
>>
>> Alastair
>>
>> Public Sub ShowDistNames()
>> Dim bolFound As Boolean
>> Dim objNS As Outlook.NameSpace
>> Dim objContact As DistListItem
>> Dim objItems As Outlook.Items
>> Dim objContactsFolder As Outlook.MAPIFolder
>> Dim objRecipient As Outlook.Recipient
>> Dim obj As Object
>> Dim i As Integer
>> bolFound = False
>> Set objNS = objOA.GetNamespace("MAPI")
>> Set objContactsFolder = objNS.GetDefaultFolder(olFolderContacts)
>> Set objItems = objContactsFolder.Items
>> For Each obj In objItems
>> If obj.Class = olDistributionList Then
>> Set objContact = obj
>> If objContact.Subject = "NonAttendanceList" Then
>> With objContact
>> For i = 1 To objContact.MemberCount
>> Set objRecipient = .GetMember(i)
>> With objRecipient
>> mvarListBox.AddItem .Name & "; ... " &
>> .Address
>> End With
>> Next
>> bolFound = True
>> End With
>> End If
>> End If
>> Err.Clear
>> Next
>> Set objNS = Nothing
>> Set obj = Nothing
>> Set objContact = Nothing
>> Set objItems = Nothing
>> Set objContactsFolder = Nothing
>> If bolFound = False Then
>> nonAtt.ShowAction ("The distribution list SportNonAttendanceList
>> is not found. " & vbCrLf & _
>> "It looks like it has been deleted, renamed or moved.")
>> Else
>> nonAtt.ShowAction ("The distribution list SportNonAttendanceList
>> was found. " & vbCrLf & _
>> "and opened successfully.")
>> End If
>> End Sub
>>
>> "Norm" <nofo@xxxxxxxxxxx> wrote in message
>> news:9aQ6f.13699$MN6.807@xxxxxxxxxxxxx
>>> Veign, Alastair,
>>>
>>> Thanks for the answer and I guess my question was not really clear or
>>> maybe I am doing the emailing wrong to begin with.
>>>
>>> The error is not coming when I loop through the contacts and add each
>>> one to a list called AllUsers. When all the contacts have been added
>>> AllUsers is used as the Recipient for Outlook email. When the Send
>>> command is given the error occurs, but the user has no idea which name
>>> has not been recognized out of the group.
>>>
>>> I was just looking for a way to check the names as the program looped
>>> through them to add them to the AllUsers group and I would trap the
>>> error here, giving the name to the user, but still letting Outlook send
>>> to the rest of the group. The way it is now when Outlook generates the
>>> error it does not send the email to anyone until the bad name is
>>> corrected.
>>>
>>> If there is not a way of doing this I could have the program send
>>> individual emails, but I would like to avoid this if possible.
>>>
>>> Not having access to a network or exchange server makes it a little
>>> difficult for me to experiment with different options.
>>>
>>> Norm
>>> "Alastair MacFarlane" <anonymous@xxxxxxxxxxxxx> wrote in message
>>> news:emBfbm$1FHA.460@xxxxxxxxxxxxxxxxxxxxxxx
>>>> Norm,
>>>>
>>>> I am sorry but I don't have a solution but merely a sense of direction
>>>> if you don't get a plausible answer. I would look down the
>>>> Collaboration Data Objects route wich will be able to query the
>>>> exchange server for information that cannot be obtained directly
>>>> through the Outlook object model.
>>>>
>>>> I am slightly confused as to why a loop through the recipients brings
>>>> up errors. Could you have different groups set up on the exchange
>>>> server and you are only looping through a subset of the whole. Our
>>>> exchange server is grouped by department and you have to select the
>>>> department to loop through the members.
>>>>
>>>> Anyway I would suggest CDO as your most likely way forward.
>>>>
>>>> I hope this helps in a small way.
>>>>
>>>> Alastair MacFarlane
>>>>
>>>> "Norm" <nofo@xxxxxxxxxxx> wrote in message
>>>> news:mJP6f.13696$MN6.9928@xxxxxxxxxxxxx
>>>>> Hi,
>>>>>
>>>>> I had asked this question in the Outlook group, but did not get an
>>>>> answer. Hopefully someone here can help me.
>>>>>
>>>>> I have an application being used in another state that emails a form
>>>>> to a
>>>>> list of people in the users contact list. They are using Outlook and
>>>>> occasionally get an error message that one or more users is not
>>>>> recognized
>>>>> by Outlook.
>>>>>
>>>>> The program loops through the list adding each name to the recipient
>>>>> list
>>>>> and I was wondering if there was a way to check each name against the
>>>>> server
>>>>> at this point to see if it is valid. I do not have access to a network
>>>>> with
>>>>> an exchange server to test this on and any help would be appreciated.
>>>>>
>>>>> Thanks,
>>>>> Norm
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
.
- Follow-Ups:
- Re: Outlook Automation Problem
- From: Norm
- Re: Outlook Automation Problem
- References:
- Outlook Automation Problem
- From: Norm
- Re: Outlook Automation Problem
- From: Alastair MacFarlane
- Re: Outlook Automation Problem
- From: Alastair MacFarlane
- Re: Outlook Automation Problem
- From: Norm
- Outlook Automation Problem
- Prev by Date: Re: Can someone get me started on system messaging
- Next by Date: Re: How to change the value of Boolean variable?
- Previous by thread: Re: Outlook Automation Problem
- Next by thread: Re: Outlook Automation Problem
- Index(es):
Relevant Pages
|