Hello everyone!
The following is the Access VBA code which opens an excel file and adds a combo box to it.
But I would like to place the combo box in particular range of cells say (A1:A20), can anyone suggest me how to do this?
Thanks in advance.
The following is the Access VBA code which opens an excel file and adds a combo box to it.
But I would like to place the combo box in particular range of cells say (A1:A20), can anyone suggest me how to do this?
Thanks in advance.
Code:
Function Create_ComboBox()
Dim XL As Excel.Application, WB As Excel.Workbook
Dim WS As Excel.Worksheet
Set XL = New Excel.Application
XL.Visible = True
XL.Interactive = True
Set WB = XL.Workbooks.Open("C:\Book1.xls", , False)
Set WS = WB.Worksheets("Example")
WS.Activate
XL.CommandBars("Control Toolbox").Visible = False
WS.OLEObjects.Add(ClassType:="Forms.ComboBox.1", Link:=False, _
DisplayAsIcon:=False, Left:=162, Top:=32.25, Width:=110.25, Height:= _
33.75).Select
End Function
Comment