VBA function for Controls in Userform

梦想的初衷 提交于 2019-12-06 17:54:25

ResetMyField(ProjectReference), with the parentheses, tries to pass the default property of the ProjectReference combobox into ResetMyField. The default property of a combobox is Value, and that is not an Object, and ResetMyField expects an Object, hence the error ("Object Required").

Remove the parentheses:

ResetMyField ProjectReference

Also note that If MyField = ProjectReference Then, again, tries to compare default properties of MyField and ProjectReference, which in case of comboboxes will mean If MyField.Value = ProjectReference.Value Then.
If you want to know if MyField is ProjectReference, then it's

If MyField Is ProjectReference Then
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!