Microsoft KB Archive/173588

= OL97: Cannot Programmatically Change Contact's E-mail Address =

Article ID: 173588

Article Last Modified on 2/12/2007

-

APPLIES TO


 * Microsoft Outlook 97 Standard Edition

-



This article was previously published under Q173588



SYMPTOMS
Using Microsoft Visual Basic Scripting Edition (VBScript) or Microsoft Visual Basic for Applications, you cannot change the e-mail address of a Microsoft Outlook 97 contact.



WORKAROUND
There is no known workaround available.



STATUS
Microsoft has confirmed this to be a problem in Microsoft Outlook. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.



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 professionals 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 a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site:

https://partner.microsoft.com/global/30000104

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:

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

You can write VBScript or Visual Basic for Applications code to initially set a contact's e-mail address. In other words, if the e-mail address field (typically Email1Address) does not have a value, then the e-mail address can be programmatically changed. If the field already contains an e-mail address, however, the value of the e-mail field will not change and you will not receive an error message.

The following Visual Basic for Applications automation code illustrates the problem: Sub ChangeEmailAddress

' The Outlook object library must be referenced. Dim ol As New Outlook.Application Dim myContact As ContactItem

' Create a new Contact item. Set myContact = ol.CreateItem(olContactItem) myContact.FullName = "Joe Smith"

' This will properly set the email address. myContact.Email1Address = "joe@abc.com" myContact.Save

' This will not change the email address. myContact.Email1Address = "mike@xyz.com" myContact.Save

' The email address appears to be changed here... MsgBox myContact.Email1Address

' ...but it is not actually changed. myContact.Display

End Sub Note that programmatically, the Email1Address will properly return the second e-mail address (mike@xyz.com) until the first e-mail address is resolved.

