Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-access > #12966
| Newsgroups | comp.databases.ms-access |
|---|---|
| Date | 2018-02-08 06:33 -0800 |
| References | <vhl3g8toslv84rk8t71v7b7jlb8b1r9i49@4ax.com> <jv04g89s68leg01aa1d7660ogoljdqf8at@4ax.com> <almarsoft.20212639235730804@news.aioe.org> <8of5g8t3i7s1id133puejk62vlrj31v8kn@4ax.com> |
| Message-ID | <a10d47a8-e12f-44ae-bb03-67bd44529dae@googlegroups.com> (permalink) |
| Subject | Re: How to find a contact in Outlook using VBA |
| From | zachsthomas@gmail.com |
On Friday, January 25, 2013 at 12:29:01 PM UTC-5, PW wrote:
> On Fri, 25 Jan 2013 20:10:51 +1100, The Frog
> <Mr.frog.to.you@googlemail.com> wrote:
>
> >On Thu, 24 Jan 2013 21:03:15 -0700, PW
> ><emailaddyinsig@ifIremember.com> wrote:
> >> I figured it out! Wow! :-)
> >
> >And how did you do it?
>
> Like this! I need to also search for the first name. More fun with
> Access's syntax ;-)
>
> Dim olApp As New Outlook.Application
> Dim olContact As Outlook.ContactItem
> Dim olNS As Outlook.NameSpace
> Dim olFolder As Outlook.MAPIFolder
>
> Dim strFirstName As String
> Dim strLastName As String
> Dim blnContinue As Boolean
> Dim varReturnVal As Variant
>
> strFirstName = Me.txtFirstName
> strLastName = Me.txtLastName
>
> Set olContact = olApp.CreateItem(olContactItem)
> Set olNS = olApp.GetNamespace("MAPI")
> Set olFolder = olNS.GetDefaultFolder(olFolderContacts)
>
> blnContinue = True
>
> If Not IsNull(strFirstName) And Not IsNull(strLastName) Then
>
> Set olContact = olFolder.Items.Find("[lastname] = " & strLastName)
>
> If Not TypeName(olContact) = "Nothing" Then 'Match found
>
> varReturnVal = MsgBox("A record with the same first and last
> names already exists in Outlook. Continue?", vbOKCancel, "Duplicate
> name")
>
> If varReturnVal = vbCancel Then
> blnContinue = False
> End If
>
> End If
>
> End If
>
> .
> .
> .
> .
Thanks PW. 5 years later this saved me quite a bit of time.
Back to comp.databases.ms-access | Previous | Next | Find similar | Unroll thread
Re: How to find a contact in Outlook using VBA zachsthomas@gmail.com - 2018-02-08 06:33 -0800
csiph-web