Results 1 to 4 of 4

Thread: [Resolved] Outlook Programming again...

Threaded View

  1. #1

    Thread Starter
    Addicted Member thedoc1's Avatar
    Join Date
    Jan 2002
    Location
    Scenic Tonawanda, NY
    Posts
    143

    Resolved [Resolved] Outlook Programming again...

    This problem has been resolved. The line was incorrect and I found a better way of handling it. Thanks for viewing this post and giving feedback.

    Again, Mark, I apologize for the incorrect post to the reputation. It was my fault. When I can, I will add to your reputation again positively.

    Doc


    I am working on creating contacts in outlook using Vb. I have the following code to remove the contacts in the folder the user selects. It has no problems in Outlook 2000, 2002 and XP. One machine is having issues using Outlook 2003. It fails on the line that is blue below. Any thoughts?

    VB Code:
    1. Dim lsngR As Single
    2.     Dim objOlApp As Outlook.Application
    3.     Dim olNs As Outlook.NameSpace
    4.     Dim olFolder As Outlook.MAPIFolder
    5.     Dim olSetFolder As Outlook.MAPIFolder
    6.     Dim lintK As Integer
    7.     Dim olContact As Outlook.ContactItem
    8.     Dim olAllContacts As Outlook.Items
    9.    
    10.     Set objOlApp = New Outlook.Application
    11.     Set olNs = objOlApp.GetNamespace("MAPI")
    12.     Set olFolder = olNs.GetDefaultFolder(olFolderContacts)
    13.     mstrV = SLParmOutlook.mstrOutlookFolderName: Call TrimString
    14.     [COLOR=RoyalBlue]Set olSetFolder = olFolder.Folders(mstrV)[/COLOR]
    15.     Set olAllContacts = olSetFolder.Items
    16.    
    17.     For lintK = olAllContacts.Count To 1 Step -1
    18.         olAllContacts.Item(lintK).Delete
    19.     Next lintK
    20.    
    21.     Set olSetFolder = Nothing
    22.     Set olAllContacts = Nothing
    23.     Set objOlApp = Nothing
    24.     Set olNs = Nothing
    25.     Set olFolder = Nothing

    Thanks for your help.
    Dave
    Last edited by thedoc1; Jan 10th, 2007 at 11:35 AM. Reason: Resolved
    Thanks

    Doc

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