Formating Phone Numbers in a Custom Contact Form

C

Charris

I found some sample VBScript on how to format a phone
number in a custom form, but I do not know how to use the
script now that I have it. Can someone please share with
this beginner how to make the script run in my custom
form? I've never used VBS before, so I need step by step
info, please.

Below is the script exactly as I found it on the web:

Sub Item_CustomPropertyChange(ByVal Name)
' Declare constants and variables
Const olContactItem = 2
Dim objPhoneFld 'As UserProperty
Dim objTempContact 'As Contact Item

' Run the code if "Phone" changed.
If Name = "Phone" Then
Set objPhoneFld = Item.UserProperties("Phone")
' Create a temporary contact item.
Set objTempContact = Application.CreateItem
(olContactItem)
' Populate a standard phone field in the temp item
' with the value of the custom phone field.
' This should resolve correctly.
objTempContact.BusinessTelephoneNumber =
objPhoneFld.Value
' Populate the custom phone field with the newly
resolved
' phone number from the standard field.
objPhoneFld.Value =
objTempContact.BusinessTelephoneNumber
' Delete the temporary item.
objTempContact.Delete
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top