Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Sets or returns a Boolean representing whether a search operation will match the character width of the searched text. Read/write.
Syntax
expression.MatchWidth
expression A variable that represents a FindReplace object.
Return value
Boolean
Remarks
This property may not be available depending on the language enabled on your operating system. The default value is False.
Returns "Access denied" if an East Asian language is not enabled.
Example
The following example finds each occurrence of the word "width" in the active document and applies bold formatting. The MatchWidth property is set to False so that full or half width characters will both be found. For example, this search will apply bold formatting to the word "width" (half-width characters) and the word " w i d t h" (full-width characters).
Dim objDocument As Document
Set objDocument = ActiveDocument
With objDocument.Find
.Clear
.FindText = "width"
.MatchWidth = False
Do While .Execute = True
.FoundTextRange.Font.Bold = msoTrue
Loop
End With
The following example finds each occurrence of the word "width" in the active document and applies bold formatting. The MatchWidth property is set to True so that either full or half width characters will be found. For example, this search will apply bold formatting to "width". It will not apply formatting to the word "w i d t h".
Dim objDocument As Document
Set objDocument = ActiveDocument
With objDocument.Find
.Clear
.FindText = "width"
.MatchWidth = True
Do While .Execute = True
.FoundTextRange.Font.Bold = msoTrue
Loop
End With
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.