RawlinsCross
Active Member
- Joined
- Sep 9, 2016
- Messages
- 437
Having a bit of an issue with something I thought would be easier (isn't that always how it is). Anyhow, I have spreadsheet with embedded ActiveX comoboxes and I want to fill each with a given range. I have a function that returns the appropriate range (I may have to convert this to a string address???) but I can't even step the code into this function as it fails before hand with the error "Object doesn't support this property". Tried researching but I think I'm getting confused with answers that are based on FORM controls rather than ACTIVEX controls.
VBA Code:
Public Sub InitializeControls()
Dim wSht As Worksheet
Dim ctrl As OLEObject
Set wSht = ThisWorkbook.Worksheets("Form")
For Each ctrl In wSht.OLEObjects
If ctrl.progID = "Forms.ComboBox.1" Then
ctrl.ListFillRange = GetControlRange(ctrl.Object.Name) '<----- Fails here (also do I need convert this to a string address?)
End If
Next ctrl
End Sub