Article ID: 282567
Article Last Modified on 6/17/2005
APPLIES TO
- Microsoft Word 2002 Standard Edition
This article was previously published under Q282567
SYMPTOMS
In Microsoft Word 2002, when you try to return a merge field by using the MappedDataField name, and your data source is an Outlook contacts folder, you receive the following error message:
NOTE: To view or modify mapped data fields in a mail merge document, click the Match Fields button in the Insert Merge Field dialog box.
CAUSE
This problem occurs if the MappedDataField name you are returning contains more than one word, such as the Business Fax, Zip/Postal Code, Home Fax, Email Address and Web Page fields in Outlook.
Microsoft Word replaces any spaces in a mail merge field with an underscore characters (_). However, when using Outlook contacts as the data source, the returned names from the MappedDataFields do not contain these underscores.
WORKAROUND
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to 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 requirements. For more information about how to use the sample code in this article, click the article number below to view the article in the Microsoft Knowledge Base:
290140 OFFXP: How to Run Sample Code from Knowledge Base Articles
When you want to return the merge field for a MappedDataField object, use the DataFieldIndex property instead of the DataFieldName property.
NOTE: The following sample macro uses the DataFieldIndex of a MappedDataField constant (wdBusinessFax) to determine the fax number for the first record in the data source.
Sub mappeDField() Dim objDsource As MailMergeDataSource Dim BFAXindex As Integer Dim objBFX As MailMergeDataField 'Return the mail merge data source. Set objDsource = ActiveDocument.MailMerge.DataSource With objDsource 'Set the first record as the active record. .ActiveRecord = wdFirstDataSourceRecord 'Return the index for the wdBusinessFax MappedDataField. BFAXindex = .MappedDataFields(wdBusinessFax).DataFieldIndex 'Return the corresponding mail merge field. Set objBFX = .DataFields(BFAXindex) 'Return the business fax number. MsgBox objBFX.Value End With End Sub
STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
MORE INFORMATION
In Word, a mapped data field represents a commonly used name or address information, such as "First Name". If a data source contains a "First Name" field or a variation (such as "First_Name," "FirstName," "First," or "FName"), the field in the data source will automatically map to the corresponding mapped data field in Word.
For more information about the MappedDataField object, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type MappedDataField object in the Office Assistant or the Answer Wizard, and then click Search to view the topic.
Additional query words: WD2002 prb VBE VBA OfficeErrorMessages 10096
Keywords: kberrmsg kbbug kbnofix kbmerge KB282567