Microsoft KB Archive/165139

= OL97: How to Reorder Outlook Address Book Names =

Article ID: 165139

Article Last Modified on 1/19/2007

-

APPLIES TO


 * Microsoft Outlook 97 Standard Edition

-



This article was previously published under Q165139



SUMMARY
In Microsoft Outlook, Contacts are listed in the Address Book in "Firstname, Lastname" order by default. This order can be toggled to "Lastname, Firstname" using the procedure outlined in this article.



MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

http://support.microsoft.com/directory/

Follow these steps to create a new mail form that will allow you to toggle the contacts listed in the Address Book between "Firstname Lastname" and "Lastname, Firstname" order:

Design a New Mail Form
 Open a new mail message:  On the File menu, point to New, and then click Mail Message to open a new mail message. On the Tools menu of the new mail message, click Design Outlook Form.  Insert two Command Buttons on the new form:  Click the (P.2) tab to go to a blank page on the form. On the Form menu, click Control Toolbox.</li> On the Toolbox dialog box click CommandButton and drag it to the blank form page.</li> Right-click the CommandButton1 and click Properties.</li> In the Caption window type "Last, First" and click OK.</li> On the Toolbox dialog box click CommandButton and drag a second button to the blank form page.</li> Right-click the CommandButton2 and click Properties.</li> In the Caption window type "First Last" and click OK.</li></ol> </li> Insert Visual Basic Scripting Edition (VBScript) code:  On the Form menu, click View Code to open the Script Editor.</li>  In the Script Editor, type or copy the following code: Sub CommandButton1_Click 'This will sort ONLY contacts in CURRENT folder by LastName, FirstName Set CurFolder=Application.ActiveExplorer.CurrentFolder If CurFolder.DefaultItemType=2 Then MsgBox "This process may take some time. You will be notified" & _ "when complete.",,"Contact Tools Message" Set MyItems=CurFolder.Items For i = 1 to MyItems.Count Set MyItem=MyItems.Item(i) If Trim(MyItem.LastNameandFirstName)<>"" Then MyItem.Subject=MyItem.LastNameandFirstName MyItem.Save End If     Next MsgBox "Done sorting Outlook Address Book contacts by Last" & _ " Name!",64,"Contact Tools Message" Else MsgBox "The current folder is not a Contact folder.",64,"Contact" & _ "Tools Message" End If  End Sub

Sub CommandButton2_Click 'This will reset contacts in CURRENT folder to FirstName LastName Set CurFolder=Application.ActiveExplorer.CurrentFolder If CurFolder.DefaultItemType=2 Then MsgBox "This process may take some time. You will be notified" & _ "when complete.",,"Contact Tools Message" Set MyItems=CurFolder.Items For i = 1 to MyItems.Count Set MyItem=MyItems.Item(i) If Trim(MyItem.FullName)<>"" Then MyItem.Subject=MyItem.FullName MyItem.Save End If     Next MsgBox "Done sorting Outlook Address Book contacts by First" & _ " Name!",64,"Contact Tools Message" Else MsgBox "The current folder is not a Contact folder.",64,"Contact" & _ " Tools Message" End If  End Sub </li> On the Script Editor File menu, click Close to return to the form.</li></ol> </li> Rename the second page tab and publish the new form:  On the Form menu, click Rename Page.</li> Type a meaningful name for this page such as, Reorder Names, and click OK.</li> <li>On the File menu, click Publish Form As.</li> <li>In the Form Name box, type a meaningful name for your new form such as, Reorder Address Book Names. Ensure that next to the Publish In button you see Personal Forms, and then click the Publish button.</li> <li>Close the message without saving.</li></ol> </li></ol>

To Use Your New Form
Follow these steps to use your new form:
 * 1) Navigate to the Contact folder you wish to re-sequence.
 * 2) On the Contact menu, click Choose Form.
 * 3) In the Personal Forms list, click your new form and click OK.
 * 4) Click the second page tab and click the appropriate button to sequence the contacts in the desired order within the Address Book.

This only affects contact names in the current folder, and only those names when viewed in the Address Book. It has no effect on the order of names within any of the Contact List views.

NOTE: The ability to sort the entire Contacts Address Book using the FileAs field was added to the Microsoft Office Service Release 2 (SR-2). For information on SR-2, please see the following article in the Microsoft Knowledge Base:

151261 OFF97: How to Obtain and Install MS Office 97 SR-2

<div class="references_section">