Well, I hope someone might know the answer.
[FONT="]In outlook 2007 , I want to change the “FileAs” default layouts for contacts.[/FONT]Available :
[FONT="]- First Last[/FONT]
[FONT="]- Last, First[/FONT]
[FONT="]- Last, First (Company)[/FONT]
[FONT="]- (Company) Last, First[/FONT]
[FONT="]I want to add one that is not listed or available by default.[/FONT]
[FONT="]The contact should be displayed as:[/FONT]
[FONT="]First Last (Company)[/FONT]
[FONT="]Example :[/FONT]
[FONT="]John Johnson (Green Tech Corp.)[/FONT]
[FONT="]I am submitting a macro for options that are found under Outlook 2007 options.[/FONT]
[FONT="]I want to add a command that will convert (FileAs) all my contacts to:[/FONT]
[FONT="]FirstName LastName (Company)[/FONT]
[FONT="]I tried few combination's but no luck sofar.[/FONT]
[FONT="]Please help.[/FONT]
[FONT="]Thank you[/FONT]
[FONT="]_______________________________[/FONT]
[FONT="]Public Sub ChangeFileAs()[/FONT]
[FONT="] Dim objOL As Outlook.Application[/FONT]
[FONT="] Dim objNS As Outlook.NameSpace[/FONT]
[FONT="] Dim objContact As Outlook.ContactItem[/FONT]
[FONT="] Dim objItems As Outlook.Items[/FONT]
[FONT="] Dim objContactsFolder As Outlook.MAPIFolder[/FONT]
[FONT="] Dim obj As Object[/FONT]
[FONT="] Dim strFirstName As String[/FONT]
[FONT="] Dim strLastName As String[/FONT]
[FONT="] Dim strFileAs As String[/FONT]
[FONT="] On Error Resume Next[/FONT]
[FONT="] Set objOL = CreateObject("Outlook.Application")[/FONT]
[FONT="] Set objNS = objOL.GetNamespace("MAPI")[/FONT]
[FONT="] Set objContactsFolder = objNS.GetDefaultFolder(olFolderContacts)[/FONT]
[FONT="] Set objItems = objContactsFolder.Items[/FONT]
[FONT="] For Each obj In objItems[/FONT]
[FONT="] 'Test for contact and not distribution list[/FONT]
[FONT="] If obj.Class = olContact Then[/FONT]
[FONT="] Set objContact = obj[/FONT]
[FONT="] With objContact[/FONT]
[FONT="] ' Uncomment the strFileAs line for the desired format[/FONT]
[FONT="] 'Lastname, Firstname (Company) format[/FONT]
[FONT="] ' strFileAs = .FullNameAndCompany[/FONT]
[FONT="] 'Firstname Lastname format[/FONT]
[FONT="] ` strFileAs = .FullName[/FONT]
[FONT="] 'Lastname, Firstname format[/FONT]
[FONT="] ' strFileAs = .LastNameAndFirstName[/FONT]
[FONT="] 'Company name only[/FONT]
[FONT="] ' strFileAs = .CompanyName[/FONT]
[FONT="] 'Companyname (Lastname, Firstname)[/FONT]
[FONT="] ' strFileAs = .CompanyAndFullName[/FONT]
[FONT="] .FileAs = strFileAs[/FONT]
[FONT="] .Save[/FONT]
[FONT="] End With[/FONT]
[FONT="] End If[/FONT]
[FONT="] Err.Clear[/FONT]
[FONT="] Next[/FONT]
[FONT="] Set objOL = Nothing[/FONT]
[FONT="] Set objNS = Nothing[/FONT]
[FONT="] Set obj = Nothing[/FONT]
[FONT="] Set objContact = Nothing[/FONT]
[FONT="] Set objItems = Nothing[/FONT]
[FONT="] Set objContactsFolder = Nothing[/FONT]
[FONT="]End Sub [/FONT]
KraFT
[FONT="]In outlook 2007 , I want to change the “FileAs” default layouts for contacts.[/FONT]Available :
[FONT="]- First Last[/FONT]
[FONT="]- Last, First[/FONT]
[FONT="]- Last, First (Company)[/FONT]
[FONT="]- (Company) Last, First[/FONT]
[FONT="]I want to add one that is not listed or available by default.[/FONT]
[FONT="]The contact should be displayed as:[/FONT]
[FONT="]First Last (Company)[/FONT]
[FONT="]Example :[/FONT]
[FONT="]John Johnson (Green Tech Corp.)[/FONT]
[FONT="]I am submitting a macro for options that are found under Outlook 2007 options.[/FONT]
[FONT="]I want to add a command that will convert (FileAs) all my contacts to:[/FONT]
[FONT="]FirstName LastName (Company)[/FONT]
[FONT="]I tried few combination's but no luck sofar.[/FONT]
[FONT="]Please help.[/FONT]
[FONT="]Thank you[/FONT]
[FONT="]_______________________________[/FONT]
[FONT="]Public Sub ChangeFileAs()[/FONT]
[FONT="] Dim objOL As Outlook.Application[/FONT]
[FONT="] Dim objNS As Outlook.NameSpace[/FONT]
[FONT="] Dim objContact As Outlook.ContactItem[/FONT]
[FONT="] Dim objItems As Outlook.Items[/FONT]
[FONT="] Dim objContactsFolder As Outlook.MAPIFolder[/FONT]
[FONT="] Dim obj As Object[/FONT]
[FONT="] Dim strFirstName As String[/FONT]
[FONT="] Dim strLastName As String[/FONT]
[FONT="] Dim strFileAs As String[/FONT]
[FONT="] On Error Resume Next[/FONT]
[FONT="] Set objOL = CreateObject("Outlook.Application")[/FONT]
[FONT="] Set objNS = objOL.GetNamespace("MAPI")[/FONT]
[FONT="] Set objContactsFolder = objNS.GetDefaultFolder(olFolderContacts)[/FONT]
[FONT="] Set objItems = objContactsFolder.Items[/FONT]
[FONT="] For Each obj In objItems[/FONT]
[FONT="] 'Test for contact and not distribution list[/FONT]
[FONT="] If obj.Class = olContact Then[/FONT]
[FONT="] Set objContact = obj[/FONT]
[FONT="] With objContact[/FONT]
[FONT="] ' Uncomment the strFileAs line for the desired format[/FONT]
[FONT="] 'Lastname, Firstname (Company) format[/FONT]
[FONT="] ' strFileAs = .FullNameAndCompany[/FONT]
[FONT="] 'Firstname Lastname format[/FONT]
[FONT="] ` strFileAs = .FullName[/FONT]
[FONT="] 'Lastname, Firstname format[/FONT]
[FONT="] ' strFileAs = .LastNameAndFirstName[/FONT]
[FONT="] 'Company name only[/FONT]
[FONT="] ' strFileAs = .CompanyName[/FONT]
[FONT="] 'Companyname (Lastname, Firstname)[/FONT]
[FONT="] ' strFileAs = .CompanyAndFullName[/FONT]
[FONT="] .FileAs = strFileAs[/FONT]
[FONT="] .Save[/FONT]
[FONT="] End With[/FONT]
[FONT="] End If[/FONT]
[FONT="] Err.Clear[/FONT]
[FONT="] Next[/FONT]
[FONT="] Set objOL = Nothing[/FONT]
[FONT="] Set objNS = Nothing[/FONT]
[FONT="] Set obj = Nothing[/FONT]
[FONT="] Set objContact = Nothing[/FONT]
[FONT="] Set objItems = Nothing[/FONT]
[FONT="] Set objContactsFolder = Nothing[/FONT]
[FONT="]End Sub [/FONT]
KraFT