Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

VBScript to Remove Unwanted Dashes, Parentheses or Spaces From Phone Numbers


TechKnowledge Content

Question:

In my source file, the column for phone number has dashes and parentheses. Sincethe phone number won't integrate correctly to Dynamics with them, how can I remove them?


Answer:
Use a VBScript to remove these unwanted characters. The complete script below uses the Replace function to replace any dash, parentheses or blank space with a null value, effectively removing it.


Dim PhoneStr

PhoneStr = SourceFields("Customers.Phone")

PhoneStr = Replace(PhoneStr,"-","")

PhoneStr = Replace(PhoneStr,"(","")

PhoneStr = Replace(PhoneStr,")","")

PhoneStr = Replace(PhoneStr," ","")

CurrentField = PhoneStr




This article was TechKnowledge Document ID:9714

↑ Back to the top


Keywords: kbmbspartner, kbmbsmigrate, kbretire, kb

↑ Back to the top

Article Info
Article ID : 867233
Revision : 1
Created on : 1/7/2017
Published on : 10/15/2011
Exists online : False
Views : 95