VBA获取组合框,以“建议”的选项 [英] VBA Get Combobox to 'suggest' an option

查看:644
本文介绍了VBA获取组合框,以“建议”的选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是比较新的VBA和我试图解决在Excel 2010中使用用户窗体工作的问题。

I am relatively new to VBA and I am trying to solve a problem working with a userform in Excel 2010.

我写一个伪错别字改正程序,验证叫板的列表。未知单词是一个文本框和允许的单词列表psented $ P $是在下面的组合框。我想组合框present基于未知单词一个建议。即未知的词是挖掘和在组合框中允许的话一个是采掘。我想在组合框中建议术语采掘。我的问题是,由于未知单词比允许的话再自动完成不提供建议。

I am writing a pseudo spell checker that validates words against a list. The unknown word is presented in a text box and the list of allowed words is in a combo box below. I would like the combo box to present a 'suggestion' based on the unknown word. i.e. the unknown word is "Excavation" and one of the allowed words in the combo box is "Excavate". I would like the combo box to suggest the term "Excavate". My problem is that autocomplete doesn't offer a suggestion because the unknown word is longer than the allowed word.

我对解决这个问题的想法是要做到以下几点:
- 解析未知单词到一个字符数组。
- 添加字符一次到组合框的文本属性,并让自动完成运行。
- 一旦自动完成停止工作,删除一个字符并插入词自动完成提示

My thought on solving the problem is to do the following: - Parse the unknown word into a character array. - Add the characters one at a time to the combo box text property and allow autocomplete to run. - As soon as autocomplete stops working, remove one character and insert the word that autocomplete suggests.

我的问题是我无法找到任何东西,告诉我一次自动完成已停止工作。

My problem is I cannot find anything to tell me once auto complete has stopped working.

任何想法,建议或其他方法的欢迎。

Any thoughts, suggestions, or alternate approaches welcome.

由于提前,

威尔

推荐答案

您可能要更改2个属性组合框以强制从列表中的条目中选择:

You may want to change 2 properties for the ComboBox to force an entry from a list is selected:


  1. MatchEntry - > 1 - fmMatchEntryComplete

  2. MatchRequired - >真

因此​​,当用户尽量选择名单之外的话,他们得到一个无效的属性值。

So when a user try to select a word outside of the list, they get a "Invalid property value.":


这篇关于VBA获取组合框,以“建议”的选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆