Thank you for looking at this for me.
I am running Outlook 2003 (11.6568.6568) SP2
Here is a version of the code:
Dim ol_app As New Outlook.Application
Dim ol_namespace As Outlook.Namespace
Dim ol_folder_contacts As Outlook.MAPIFolder
Dim ol_folder_volunteers As Outlook.MAPIFolder
Dim ol_xplorer As Outlook.Explorer
Dim ol_dist_list As Outlook.DistListItem
Dim ol_recipient As Outlook.Recipient
Dim ol_temp_mail As Outlook.MailItem
Dim sycs As Outlook.SyncObjects
Dim syc As Outlook.SyncObject
Dim rs As New ADODB.Recordset
Dim first_up As Boolean
Dim prevGroup As String
Dim i As Long
DoCmd.Hourglass True
Set ol_namespace = ol_app.GetNamespace("MAPI")
Set ol_folder_contacts = ol_namespace.GetDefaultFolder(olFolderContacts)
For i = 1 To ol_folder_contacts.Folders.Count
If ol_folder_contacts.Folders(i) = "Volunteers" Then
Set ol_folder_volunteers = ol_folder_contacts.Folders(i)
ol_folder_volunteers.ShowAsOutlookAB = False
Set ol_folder_volunteers = Nothing
ol_folder_contacts.Folders.Remove i
Exit For
End If
Next
Set ol_folder_volunteers = ol_folder_contacts.Folders.Add("Volunteers")
ol_folder_volunteers.ShowAsOutlookAB = True
Note that the code is acutally running in Access - not Outlook. What I am
trying to acheive is having my Access App generate a new Volunteers folder
and populate it with a contacts.
As I said in the original post - everything seems to be working except that
the old folder still appears under My Contacts.
Usually I do not have Outlook Explorer running while I run the code in
Access. So I first see the problem when I launch the Outlook and goto the
Contacts Folder.
Another aspect of the problem is that it appears to correct itself over
time. Eventually the old folder will disappear. It usually take about 30
minutes to do so - with Outlook explorer not active.
Again - thanks for looking at this.
Sean
"Eric Legault [MVP - Outlook]" wrote:
> Strange, I can't reproduce this at all. Can you show your code? What is
> your full Outlook version and build number?
>
> --
> Eric Legault (Outlook MVP, MCDBA, old school WOSA MCSD, B.A.)
> Try Picture Attachments Wizard for Outlook:
> http://www.collaborativeinnovations.ca
> Blog: http://blogs.officezealot.com/legault/
>
>
> "Sean" wrote:
>
> > I am using VBA to create and delete folders in the default contact folder.
> > This seems to be working fine - the new folder is always created and the
> > items that I generate are included in the new folder.
> >
> > The problem is that when I go into the Contacts folder in Outlook Explorer I
> > still see the old folder in My Contacts. When I click on the old entry
> > Explorer says that the folder has been deleted. So how do I remove the
> > reference to this folder from My Contacts.
> >
> > The old folder also persists in the list of folders to be used as an address
> > book.