LanguageDetected 属性 (Word)Selection.LanguageDetected property (Word)

返回或设置一个Boolean类型的值, 该值指定 Microsoft Word 是否已检测到所选文本的语言。Returns or sets a Boolean that specifies whether Microsoft Word has detected the language of the selected text.


expression.expression. LanguageDetected

_表达式_是必需的。expression Required. 表示 Selection 对象的变量。A variable that represents a Selection object.


检查任何以前的语言检测结果的LanguageID属性。Check the LanguageID property for the results of any previous language detection.

调用DetectLanguage方法时, LanguageDetected属性设置为TrueThe LanguageDetected property is set to True when the DetectLanguage method is called. 重新计算指定文本的语言,您必须首先设置 LanguageDetected 属性。To reevaluate the language of the specified text, you must first set the LanguageDetected property to False.


本示例检查活动文档以确定用于编写它的语言,然后显示结果。This example checks the active document to determine the language it's written in and then displays the result.

With Selection 
 If .LanguageDetected = True Then 
 x = MsgBox("This document has already " _ 
 & "been checked. Do you want to check " _ 
 & "it again?", vbYesNo) 
 If x = vbYes Then 
 .LanguageDetected = False 
 End If 
 End If 
 If .Range.LanguageID = wdEnglishUS Then 
 MsgBox "This is a U.S. English document." 
 MsgBox "This is not a U.S. English document." 
 End If 
End With

另请参阅See also

Selection 对象Selection Object

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.