【发布时间】:2013-06-08 15:20:38
【问题描述】:
如何在 Excel VBA 中设置组合框文本字段和值字段,就像我们在 web 应用程序中设置下拉列表一样,例如,
DropdownList.DataTextField ="EmpName";
DropdownList.DataValueField = "EmpCode";
【问题讨论】:
如何在 Excel VBA 中设置组合框文本字段和值字段,就像我们在 web 应用程序中设置下拉列表一样,例如,
DropdownList.DataTextField ="EmpName";
DropdownList.DataValueField = "EmpCode";
【问题讨论】:
With ComboBox1
.AddItem "Item1"
.AddItem "Item2"
End With
或
ActiveSheet.Shapes("ComboBox1").ListFillRange = "A1:A10"
【讨论】:
当我从 Access VBA 创建 Excel ComboBox 时,我使用了以下 sytnax:
With ActiveSheet.OLEObjects.Add(ClassType:="Forms.ComboBox.1")
With .Object
.TextAlign = 2
'.LinkedCell = "D6"
'.ListFillRange = "G16:G23"
End With
End With
但在 Excel 中,这两条注释行似乎不起作用。希望有帮助吗?
【讨论】: