Results 1 to 2 of 2

Thread: new way of checking duplicate entries kinndly help

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2005
    Posts
    490

    Question new way of checking duplicate entries kinndly help

    VB Code:
    1. Private Sub oSaveAs_Click(ByVal Ctrl As Office.CommandBarButton, CancelDefault As Boolean)
    2.    
    3.      Dim oSel As Outlook.Selection
    4.     Dim oEmail As Outlook.MailItem
    5.     Dim oContact As Outlook.ContactItem
    6.     Dim pContact As Outlook.ContactItem
    7. Dim Item As Outlook.MailItem
    8.     Set oSel = Application.ActiveExplorer.Selection
    9.    For Each Item In oSel
    10.    If Item.Class = olMail Then
    11.     Set oEmail = Item
    12.    
    13.         Set oContact = Application.CreateItem(olContactItem)
    14.        
    15.         Set pContact = Application.CreateItem(olContactItem)
    16.        
    17.        With oContact
    18.             .Subject = oEmail.Subject
    19.             .Email1Address = oEmail.SenderEmailAddress
    20.            
    21.             .FullName = oEmail.SenderName
    22.             '.Body = oEmail.Body
    23.          
    24.             .Display
    25.         End With
    26.        
    27.         With pContact
    28.         .FullName = oEmail.SenderName
    29.         .Email1Address = oEmail.SenderEmailAddress
    30.      
    31.         .Display
    32.         End With
    33.        
    34.          If ((oContact.Email1Address = pContact.Email1Address)) Then
    35.    
    36.      
    37.      MsgBox "Contact Exists"
    38.            'pContact
    39.      
    40.       Else
    41.   oContact.Save
    42.      MsgBox "Saved"
    43.      Set oContact = Nothing
    44.         Set oEmail = Nothing
    45.         Set oContact = Nothing
    46.    
    47.     Set oSel = Nothing
    48.  
    49.  End If
    50.  
    51.      
    52.      
    53.  End If
    54.  
    55.  
    56.  
    57.  
    58. Next
    59. End Sub


    above is the code i have been working upon. the problem is it is not checking whether the contacts are same but the code is running.
    very confused kindly help
    visual basic.net (2008)

    .net framework 3.5


  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: new way of checking duplicate entries kinndly help

    what part doesn't work? do you get a message box or does it save the contact each time

    put a break point at each if statement to see where it goes

    pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width