如何通过windows api在vba中填充comvobox?
我想通过任何api或其他方式在VBA中填充combobox。。 我想避免硬编码条目如何通过windows api在vba中填充comvobox?,vba,excel,Vba,Excel,我想通过任何api或其他方式在VBA中填充combobox。。 我想避免硬编码条目 Set FontList = Application.CommandBars("Formatting").FindControl(ID:=1728) ' If Font control is missing, create a temp CommandBar If FontList Is Nothing Then Set Tempbar = Application.CommandBars.Add
Set FontList = Application.CommandBars("Formatting").FindControl(ID:=1728)
' If Font control is missing, create a temp CommandBar
If FontList Is Nothing Then
Set Tempbar = Application.CommandBars.Add
Set FontList = Tempbar.Controls.Add(ID:=1728)
End If
' Put the fonts into column A
'Range("A:A").ClearContents
For i = 0 To FontList.ListCount - 1
cbmFontList.value = FontList.List(i + 1)
Next i
' Delete temp CommandBar if it exists
On Error Resume Next
Tempbar.Delete
我正在尝试这段代码,但它不起作用。它看起来不像是在填充组合框。看起来您正在从组合框填充Excel工作表。这就是你需要做的吗?对不起,我忘了提到Combobox。。我现在编辑了我的帖子,你能帮帮我吗?看起来你不是在填充组合框。看起来您正在从组合框填充Excel工作表。这就是你需要做的吗?对不起,我忘了提到Combobox。。我现在编辑了我的帖子,你能帮我吗。