匹配列表条目Match entries in a list

Microsoft Forms 提供了三种将用户输入的值与**ListBox** 或**ComboBox** 列表中存在的条目相匹配的方法:Microsoft Forms provides three ways to match a value entered by the user with an entry that exists in the list of a ListBox or ComboBox:

  • 无匹配在将用户键入的条目与列表中的条目匹配时不提供任何帮助。No matching provides no assistance in matching a user's typed entry to an entry in the list.

  • 首字母将最近键入的字母与列表中每个条目的第一个字母进行比较。First letter compares the most recently-typed letter to the first letter of each entry in the list. 将选中列表中首个匹配项。The first match in the list is selected.

  • 完成比较用户的输入, 并尝试从列表中的条目中查找完全匹配项。Complete compares the user's entry and tries to find an exact match in an entry from the list.

该匹配功能将在两秒后重置(如果您使用的是东亚设置则需 6 秒)。The matching feature resets after two seconds (six seconds if you are using East Asia settings). 例如,如果您的列表有 50 个州且快速键入"CO",则您将查找到"Colorado"。For example, if you have a list of the 50 states and you type "CO" quickly, you will find "Colorado." 如果您缓慢地键入"CO",则您将查找到"Ohio",因为自动完全搜索在字母之间重置。But if you type "CO" slowly, you will find "Ohio" because the auto-complete search resets between letters.

如果选择 "完全匹配", 则最好按字母顺序对列表条目进行排序 (您可以使用**TextColumn** 属性来执行此操作)。If you choose Complete matching, it is a good idea to sort the list entries alphabetically (you can use the TextColumn property to do this). 如果列表没有按字母顺序排序,则该匹配方法可能无法正常运行。If the list is not sorted alphabetically, matching may not work correctly. 例如, 如果列表中包含 Alabama、Louisiana 和阿拉斯加的顺序, 则当用户键入 "亨茨维尔" 时, "Alabama" 将被视为一个完整的匹配项。For example, if the list includes Alabama, Louisiana, and Alaska in that order, "Alabama" will be considered a complete match if the user types "ala." 实际上,此结果是不明确的,因为在列表中有两个条目与用户输入项相匹配。In fact, this result is ambiguous because there are two entries in the list that could match what the user entered. 按字母顺序排序可以消除这种不明确性。Sorting alphabetically eliminates this ambiguity.

另请参阅See also

支持和反馈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.