OL97: How to Correct Formatting and Parsing of Imported Contacts

Last reviewed: February 27, 1998
Article ID: Q166333
The information in this article applies to:
  • Microsoft Outlook 97

SUMMARY

Importing contacts into Microsoft Outlook 97 results in incorrectly formatted or parsed address and fax number fields. Although the information may look correct when viewed in an Outlook form, it may result in erratic behavior when other routines or programs use the information.

This article outlines a procedure using VBScript to correct this.

Microsoft has confirmed this to be a problem in Microsoft Outlook 97 for Windows. This problem was corrected in Microsoft Outlook 97 version 8.02 for Windows.

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://www.microsoft.com/support/supportnet/refguide/default.asp

Follow these steps to create a new post form to correct the imported contact records.

Design a New Post Form

  1. Open a new post message:

        a. On the Inbox File menu, point to New, and then click "Post in This
           Folder."
    

        b. On the Tools menu of the new Post form, click Design Outlook
           Form.
    

  2. Insert a Command Button on the new form:

        a. Click the (P.2) tab to go to a blank page on the form.
    

        b. On the Form menu, click Control Toolbox.
    

        c. On the Toolbox dialog, click CommandButton and drag it to the
           blank form page.
    

        d. Right-click CommandButton1 and click Properties.
    

        e. In the Caption window type, "Correct Contacts" and click OK.
    

  3. Insert VBScript code:

        a. On the Form menu, click View Code to open the Script Editor.
    

        b. In the Script Editor, type or copy the following code:
    

         Sub CommandButton1_Click()
         'This will only work on contacts in the CURRENT folder
         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)
          MyItem.MailingAddressStreet=MyItem.MailingAddressStreet
          MyItem.MailingAddressCity=MyItem.MailingAddressCity
          MyItem.MailingAddressState=MyItem.MailingAddressState
          MyItem.MailingAddressPostalCode=MyItem.MailingAddressPostalCode
          MyItem.MailingAddressPostOfficeBox=MyItem.MailingAddressPostOfficeBox
          MyItem.CompanyName=MyItem.CompanyName
          MyItem.HomeFaxNumber=MyItem.HomeFaxNumber
          MyItem.BusinessFaxNumber=MyItem.BusinessFaxNumber
          MyItem.OtherFaxNumber=MyItem.OtherFaxNumber
          MyItem.EMail1Address=MyItem.EMail1Address
          MyItem.EMail2Address=MyItem.EMail2Address
          MyItem.EMail3Address=MyItem.EMail3Address
          MyItem.Body=MyItem.Body
          MyItem.Sensitivity=MyItem.Sensitivity
               MyItem.Save
             Next
          MsgBox "Done!",64,"Contact Tools Message"
         Else
          MsgBox "The current folder is not a Contact folder.",64,"Contact" & _
         " Tools Message"
         End If
         End Sub
    
         (Insert VBScript code step continued)
    
        c. On the Script Editor File menu, click Close to return to the form.
    
    

  4. Rename the second page (p.2) tab and publish the new form:

        a. On the Form menu, click Rename Page.
    

        b. Type a name for this page such as, Correct Contacts, and
           click OK.
    

        c. On the File menu, click Publish Form As.
    

        d. In the "Form Name" box, type a name for your new form such as,
           "Correct Contacts" (without the quotation marks) and then click the
           "Publish In" button.
    

        e. Click the "Forms Library" option button and click "Personal Forms"
           in the drop-down box.
    

        f. Click OK and click Publish.
    

        g. Close the message without saving.
    

To Use Your New Form

  1. Navigate to the folder containing the contacts you wish to correct.

  2. On the Contacts 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 button (Correct Contacts from Step 2e above) to correct the contacts in the current folder.

    NOTE: This only affects contact names in the current folder.

REFERENCES

For information on manually correcting individual records, please see the following article(s)in the Microsoft Knowledge Base:

   ARTICLE-ID:  Q164401
   TITLE     :  OL97: Using Contacts with Word's Insert Address Feature

   ARTICLE-ID:  Q164408
   TITLE     :  OL97: Imported Fax Numbers May Not Work in Outlook

   ARTICLE-ID:  Q164477
   TITLE     :  OL97: Address Displays Incorrectly on Imported Contacts

For more information about creating solutions with Microsoft Outlook 97, please see the following articles in the Microsoft Knowledge Base:

   Article-ID: Q166368
   Title     : OL97: How to Get Help Programming with Outlook

   Article-ID: Q170783
   Title     : OL97: Q&A: Questions about Customizing or
               Programming Outlook


Additional query words: OutSol OutSol97
Keywords : kbcode
Version : 97 8.02
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 27, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.