View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
george george is offline
external usenet poster
 
Posts: 18
Default CombBox - Object of What Collection?

Thank you, Juan for pointing that out. I didn't notice I had that left that off as I don't really see what it is doing. However, it finally worked as follows. I thank you and Tom, much.

Could either of you tell me why the .Object is needed after oleObj as I thought that oleObj was referring to an Ole Object as it seems to be identified as such and addressed as part of the OLEObjects Collection in the For Each statement? Thus to add .Object would seem redundant and be a reference to an object of the same object? Could you please straighten out my thinking on this?

Dim oleObj As OLEObject, cboItem As MSForms.ComboBox

With Application.Workbooks(1).Worksheets(1)
For Each oleObj In .OLEObjects
If TypeOf oleObj.Object Is MSForms.ComboBox Then
Set cboItem = oleObj.Object
cboItem.ListIndex = -1
End If
Next oleObj
End With

Again, I thank you both for and appreciate your keen expertise for I had tried many scenarios, but this did not occur to me.