Excel 2007 VBA ActiveXcombobox添加424错误

我坚持添加一个ActiveX组件。 我在Excel 2007中使用VBA添加一个ActiveXcombobox时收到错误代码424.我希望这里有人会如此善良,帮助我。

Sub addComboBx() Dim countColl As Double Dim cbx_name As String Dim objChBx As OLEObject Dim comboBx As ComboBox Dim rng As Range Dim rowNr As Double rowNr = 27 lastRow = 115 LastRange = "B2: F" & lastRow arrayCountry = Worksheets("Sheet 1").Range(LastRange).Value countColl = countRows(rowNr) 'Sub that counts rows from line X untill the value of checked cell in next row is equal "" (empty string) Worksheets("Sheet 2").Cells((rowNr + countColl), 1).EntireRow.Insert cbx_name = "Cbx_countries_list_" & (countColl + 1) Set rng = Worksheets("Sheet 2").Cells((rowNr + countColl), 3) '-> In line below I have Error 424 'Object required' With Worksheets("Sheet 2").OLEObjects.Add(ClassType:="Forms.ComboBox.1", link:=False, DisplayAsIcon:=False, Left:=rng.Left, Top:=rng.Top, Width:=rng.Width, Height:=rng.Height) With .Object For a = LBound(arrayCountry) To UBound(arrayCountry) .AddItem arrayCountry(a, 1) Next a End With Set comboBx = .Object With comboBx .Value = Sheets("Sheet 2").Cbx_countries_list.Value .Placement = xlMove .PrintObject = True .Name = cbx_name End With End With End Sub 

我无法弄清楚,为什么我有这个424错误。 我检查了这个和其他论坛,并没有find解决办法。

这里是错误发生的地方:

 With Worksheets("Sheet 2").OLEObjects.Add(ClassType:="Forms.ComboBox.1", link:=False, DisplayAsIcon:=False, Left:=rng.Left, Top:=rng.Top, Width:=rng.Width, Height:=rng.Height) 

我不知道这可能是重要的。 上面的代码在单独的模块中,而不是在工作表中,因为单击button后会调用它