OL98: How to Programmatically Add '+1' to Contact Fax Numbers
ID: Q193981
|
The information in this article applies to:
NOTE: These procedures only apply if you have installed Outlook with the
Internet Mail Only (IMO) option. To determine your installation type, on
the Help menu click About Microsoft Outlook. In About Microsoft Outlook you
should see "Internet Mail Only" if you have the Internet Mail Only option
installed.
SUMMARY
The WinFax Starter Edition fax program, installed with Microsoft Outlook
(IMO), requires a +1 at the beginning of the fax numbers in order to dial
correctly. If you are dialing from a contact fax number, you must insert
the +1 into the fax number for the contact record.
This article outlines a procedure for using VB Script to insert the +1 into
all the contact record fax numbers programmatically.
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
This article assumes that you are familiar with Visual Basic Scripting
and with creating Microsoft Outlook forms using the programming tools
provided with Outlook. For more information about getting help with
Visual Basic Scripting, please see following article in the Microsoft
Knowledge Base:
Q166368
OL97: How to Get Help Programming with Outlook
Follow these steps to create a new post form to modify the contact record
fax numbers.
Design a New Post Form
- On the File menu, point to New, and click "Post in This Folder."
- On the Tools menu of the new Post form, point to Forms and click Design
This Form.
- Click the (P.2) tab to go to a blank page on the form, and on the Form
menu, click Control Toolbox.
- Click CommandButton and drag it to the blank form page.
- Right-click CommandButton1, click Properties, and in the Caption window
type "Correct Fax Numbers" (without the quotation marks) and click OK.
- On the Form menu, click View Code and 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)
If Left(MyItem.HomeFaxNumber,2)<>"+1" and _
MyItem.HomeFaxNumber<> "" Then
MyItem.HomeFaxNumber="+1" & MyItem.HomeFaxNumber
End If
If Left(MyItem.BusinessFaxNumber,2)<>"+1" and _
MyItem.BusinessFaxNumber<> "" Then
MyItem.BusinessFaxNumber="+1" & MyItem.BusinessFaxNumber
End If
If Left(MyItem.OtherFaxNumber,2)<>"+1" and _
MyItem.OtherFaxNumber<> "" Then
MyItem.OtherFaxNumber="+1" & MyItem.OtherFaxNumber
End If
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
- On the File menu in Script Editor, click Close to return to the form.
- On the Form menu, click Rename Page and type a name for this page such
as "Correct Fax Numbers" (without the quotation marks), and click OK.
Publish the New Form
- On the Tools menu, point to Forms and click Publish Form As.
- In the "Look in" list click to select Personal Forms Library. Type a
name for your new form such as, "Correct Fax Numbers" (without the
quotation marks) and then click Publish.
- On the File menu, click Close, and then click No to close without
saving.
To Use Your New Form
- Click to select the folder containing the contacts you want to correct.
- On the File menu, point to New and click Choose Form.
- In the Look In list, click to select Personal Forms Library,
click your new form and click Open.
- On the second page tab, click the button ("Correct Fax Numbers" from
earlier in this article) to correct the fax numbers in the current
folder.
NOTE: This only affects fax numbers in the current folder.
Additional query words:
98
Keywords : FmsHowto ScriptHowTo
Version : WINDOWS:
Platform : WINDOWS
Issue type : kbhowto
|