Microsoft KB Archive/922081

= You do not find instances of a character that are associated with a combining diacritical mark when you search a document in Word 2007 =

Article ID: 922081

Article Last Modified on 10/15/2007

-

APPLIES TO


 * Microsoft Office Word 2007

-





For a Microsoft Word 2002 and Microsoft Office Word 2003 version of this article, see 886954.



SYMPTOMS
Consider the following scenario. You search a Microsoft Office Word 2007 document for a character string. To do this, you click the Home tab, click Editing, and then click Find. Alternatively, you use a Microsoft Visual Basic for Applications (VBA) macro.

In this scenario, you may experience one or more of the following symptoms:
 * When you search for a character, you do not find instances of that character that are associated with a combining diacritical mark, such as an accent mark.
 * When you search for a combining diacritical mark, you do not find instances of that combining diacritical mark that are associated with a character.

Note Combining diacritical marks are Unicode characters that are used to modify other characters. A combining diacritical mark always follows the character that it modifies in a Word document.



CAUSE
In a Word 2007 document, you can locate a character and its combining diacritical mark only when you search for the character together with its combining diacritical mark.



WORKAROUND
To work around this issue, use one or more of the following methods.

Method 1: Locate all characters that are associated with combining diacritical marks
 Open the Word document. Click the Home tab. Click Editing, and then click Find. Click More, and then click to clear the Use wildcards check box. In the Find What box, type the following search string:

?[ALT+768-ALT+879]

To type the ALT+768 and ALT+879 characters, press and hold the ALT key while you type the number by using the numeric keypad. For example, to type ALT+768, press and hold the ALT key while you type 768 by using the numeric keypad.

Note The question mark in this search string matches any character. The left bracket and the right bracket specify a range of values. The numbers 768 to 879 are the decimal codes that correspond to the first and the last combining diacritical marks in Unicode (U+0300 to U+036f). When you press and hold ALT and then type these decimal codes, you insert the corresponding combining diacritical mark. Repeatedly click Find Next to locate all the characters that are associated with combining diacritical marks.</li></ol>

Note You can use this method to find and to replace characters that are associated with combining diacritical marks.

Method 2: Locate a specific combination of a character and a combining diacritical mark

 * 1) Open the Word document.
 * 2) Click the Home tab.
 * 3) Click Editing, and then click Find.
 * 4) Click More, and then click to select the Use wildcards check box.
 * 5) In the Find What box, type the appropriate search string. Use one of the following methods, as appropriate for your situation:
 * 6) * If you know the Unicode hexadecimal value for the combining diacritical mark that you want, type the character followed by the Unicode hexadecimal value for the combining diacritical mark, and then press ALT+X.

For example, to search for the character &quot;L&quot; when it is associated with the combining diacritical mark that has a Unicode hexadecimal value of 301, type L301, and then press ALT+X.
 * 1) * If you know the decimal code for the combining diacritical mark that you want, type ^u.

For example, to search for the character &quot;L&quot; when it is associated with the combining diacritical mark that has a decimal code of 769, type L^u769.
 * 1) Repeatedly click Find Next to locate all instances of the character and its combining diacritical mark.

Note You can use this method to find and to replace characters that are associated with combining diacritical marks.

Method 3: Run a VBA macro
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. The following VBA macro locates all combinations of characters and combining diacritical marks. The macro replaces each combination with a string. The string is the text &quot;HELLO.&quot; 'This Word macro replaces all combinations of a character 'and a combining diacritical mark for a selected part of 'a document. The replacement text is &quot;HELLO.&quot;

Sub findcombined

'Clear any formatting that is specified for a find operation. ' Selection.Find.ClearFormatting

'Clear any formatting that is specified for a replace operation. ' Selection.Find.Replacement.ClearFormatting

'Set up a Find and Replace operation. ' With Selection.Find

'Set the Find What string to find all combinations of a character and 'a combining diacritical mark, where &ChrW represents a character and '&H300 and &H36F represent the start and the end of the hexadecimal 'values that correspond to the range of combining diacritical marks 'in Unicode. ' .Text = &quot;?[&quot; &ChrW(&H300) & &quot;-&quot; &ChrW(&H36F) & &quot;]&quot;

'Set the Replace with text to &quot;HELLO.&quot; ' .Replacement.Text = &quot;HELLO&quot;

'Set the search direction to search forward in the document. ' .Forward = True

'Set the Find and Replace operation to wrap around to the start 'of the document when the end of the document is reached. This operation makes sure 'that the all the selected part of the document is searched. ' .Wrap = wdFindContinue

'Clear any Format settings. ' .Format = False

'Clear the Match case setting. ' .MatchCase = False

'Clear the Find whole words only setting. ' .MatchWholeWord = False

'Clear the Use wildcards setting. ' .MatchWildcards = True

'Clear the Sounds like setting. ' .MatchSoundsLike = False

'Clear the Find all word forms setting.' .MatchAllWordForms = False

End With

'Execute the Find and Replace operation

Selection.Find.Execute Replace:=wdReplaceAll

End Sub

Additional query words: word2007 word2k7 word12 wd2007 wd2k7 wd12

Keywords: kbtshoot kbmacro kbprogramming kbautomation kbprb kbvba kbfindreplace kbexpertisebeginner KB922081

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.