C
Céline Brien
Hi !
Recently I had help from Ken Slovak in creating a macro to delete
Contacts of a category.
If I modify this macro, is it possible to obtain a macro to rename a
category ?
Thanks for your help,
Céline
--------------------------
Option Explicit
Sub RenameCategory()
''
Dim ol_App As New Outlook.Application
Dim ol_Mapi As Outlook.NameSpace
Dim ol_Folder As Outlook.MAPIFolder
Dim ol_Items As Outlook.Items
Dim ol_Itm As Object
Dim LgI As Long
Set ol_Mapi = ol_App.GetNamespace("MAPI")
Set ol_Folder = ol_Mapi.GetDefaultFolder(olFolderContacts)
Set ol_Items = ol_Folder.Items
For LgI = ol_Items.Count To 1 Step -1
Set ol_ContactItm = ol_Items(LgI)
If ol_ContactItm.Class = olContact Then
If ol_ContactItm.Categories = "Excel" Or InStr(1,
ol_ContactItm.Categories, "; Excel") Or InStr(1,
ol_ContactItm.Categories, "Excel;") Then
ol_ContactItm.Rename
????? How do I indicate the new name ??????
End If
End If
Next LgI
Set ol_ContactItm = Nothing
Set ol_Items = Nothing
Set ol_Folder = Nothing
Set ol_Mapi = Nothing
Set ol_App = Nothing
End Sub
Recently I had help from Ken Slovak in creating a macro to delete
Contacts of a category.
If I modify this macro, is it possible to obtain a macro to rename a
category ?
Thanks for your help,
Céline
--------------------------
Option Explicit
Sub RenameCategory()
''
Dim ol_App As New Outlook.Application
Dim ol_Mapi As Outlook.NameSpace
Dim ol_Folder As Outlook.MAPIFolder
Dim ol_Items As Outlook.Items
Dim ol_Itm As Object
Dim LgI As Long
Set ol_Mapi = ol_App.GetNamespace("MAPI")
Set ol_Folder = ol_Mapi.GetDefaultFolder(olFolderContacts)
Set ol_Items = ol_Folder.Items
For LgI = ol_Items.Count To 1 Step -1
Set ol_ContactItm = ol_Items(LgI)
If ol_ContactItm.Class = olContact Then
If ol_ContactItm.Categories = "Excel" Or InStr(1,
ol_ContactItm.Categories, "; Excel") Or InStr(1,
ol_ContactItm.Categories, "Excel;") Then
ol_ContactItm.Rename
????? How do I indicate the new name ??????
End If
End If
Next LgI
Set ol_ContactItm = Nothing
Set ol_Items = Nothing
Set ol_Folder = Nothing
Set ol_Mapi = Nothing
Set ol_App = Nothing
End Sub