Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何通过windows api在vba中填充comvobox?_Vba_Excel - Fatal编程技术网

如何通过windows api在vba中填充comvobox?

如何通过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

我想通过任何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 = 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。。我现在编辑了我的帖子,你能帮我吗。