Microsoft KB Archive/257930

= OL2000: How to Re-Order Outlook Address Book Distribution List Names =

Article ID: 257930

Article Last Modified on 9/29/2003

-

APPLIES TO


 * Microsoft Outlook 2000 Standard Edition

-



This article was previously published under Q257930



SUMMARY
This article describes how to list contacts in an Address Book Distribution List (DL) in either "Firstname Lastname" order or mixed order in Outlook. You can convert this order in the DL to all "Lastname, Firstname" or all "Firstname Lastname."



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 that is being demonstrated and with the tools that are 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 view the Microsoft Web site:

http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS#overview

To create a new Contacts form that allows you to toggle the contacts listed in the Address Book between "Firstname Lastname" order and "Lastname, Firstname" order, use the steps in the following section.

Open a New Contact

 * 1) On the File menu, point to New, and then click Contact.
 * 2) Click Tools, point to Forms, and then click Design This Form.

Insert Two Command Buttons on the New Form
To insert command buttons on the new form:
 * 1) Click the (P.2) tab to open a blank page on the form.
 * 2) Click Control Toolbox on the Form menu.
 * 3) In the Toolbox dialog box, click CommandButton, and then drag the CommandButton to the blank form page.
 * 4) Right-click the CommandButton1 control in the form, and then click Properties.
 * 5) In the Caption box, type Last, First, and then click OK.
 * 6) In the Toolbox dialog box, click CommandButton, and then drag a second button to the blank form page.
 * 7) Right-click the CommandButton2 control in the form, and then click Properties.
 * 8) In the Caption box, type First Last, and then click OK.

Insert Visual Basic Scripting Edition (VBScript) Code
To insert VBScript code:  Click View Code on the Form menu.  In the Script Editor box, type or paste the following: Sub CommandButton1_Click 'The following code only sorts contacts in the 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 UCase(Left(MyItem.MessageClass, 11)) = "IPM.CONTACT" then If Trim(MyItem.LastNameandFirstName)<>"" Then MyItem.Subject=MyItem.LastNameandFirstName MyItem.Save End If       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 'The following code resets 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 UCase(Left(MyItem.MessageClass, 11)) = "IPM.CONTACT" then If Trim(MyItem.FullName)<>"" Then MyItem.Subject=MyItem.FullName MyItem.Save End If       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  On the File menu, click Close.

Rename the Second Page Tab and Publish the New Form
To rename the second page tab and publish the new form:
 * 1) Click Rename Page on the Form menu.
 * 2) Type a name for this page (for example, Re-order Names ), and then click OK.
 * 3) On the Tools menu, point to Forms, and then click Publish Form As.
 * 4) In the Form Name box, type a name for your new form (for example, Re-order Address Book Names ).
 * 5) In the Look In box, click Personal Forms Library, and then click Publish.
 * 6) Close the message without saving it.

How to Use Your New Form
To make your new form the default Contacts form:
 * 1) Verify that the Folder List pane is visible. If you do not see the Folder List pane, click Folder List on the View menu.
 * 2) In the Folder List pane, right-click the Contacts folder, and then click Properties. In the When Posting to this folder, use box, and then click Forms....
 * 3) In the Look In box, click Personal Forms Library (this is the location where you published your new form), click the form, and then click Open.
 * 4) Click OK to close the Contacts Properties dialog box.

How to Use the Re-Order Names Functionality of Your New Form
To use the Re-Order Names functionality of your new form:
 * 1) Click the Contacts folder in the Folder List pane.
 * 2) On the File menu, point to New, and then click Contact.
 * 3) On the Re-order Names tab, click Last, First or click First Last.
 * 4) In the This process may take some time... dialog box, click OK.
 * 5) In the Done sorting... dialog box, click OK.
 * 6) Close the form without saving it.

This procedure only affects contact names in the current folder when you view those names in your Address Book. This procedure does not affect the order of names in any of the Contact List views.

Additional query words: OL2K Outsol Outsol2000 vbscript

Keywords: kbhowto KB257930

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.