开发者

How to cast a shape object?

开发者 https://www.devze.com 2022-12-18 10:11 出处:网络
I want to assign a ComboBox control to a class member of ComboBox type. This control is in a group on 开发者_如何学Goa worksheet.

I want to assign a ComboBox control to a class member of ComboBox type. This control is in a group on 开发者_如何学Goa worksheet.

The problem is through GroupItems property, I can only get a Shape object, not a ComboBox. So when assigning, it alerts "type mismatch".

If the control was not in a group, I could get an OLEObject object through OLEObjects property, and then use Object property to bypass the type mismatch. But what about now?


Once you have your Shape object, whether it is in a Group or not, you can access the ComboBox through the DrawingObject.Object property. So it would look something like

Set cboVariable = ActiveSheet.Shapes(1).GroupItems(2).DrawingObject.Object
0

精彩评论

暂无评论...
验证码 换一张
取 消