View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Andrew[_16_] Andrew[_16_] is offline
external usenet poster
 
Posts: 66
Default Reference oleobject within shape group

Stephen,

Thanks for the help. When I run your suggestion I get an error though
("Obj doesn't support this method or property"). I wonder if I'm
stuck here because GroupItems seems to only return a shape object.
Let me know if you've got any other ideas though.

Thanks,
Andrew


Stephen Bullen wrote in message ...
Hi Andrew,

I have a group of shapes which includes an MSForms.SpinButton. I can
reference this using the following:

Dim sh As Shape
Set sh = Sheets("Overview").Shapes("Group 447").GroupItems(2)
Debug.Print sh.Name

However, I want to set the reference to the OLE object not just the
shape (so that I can use WithEvents to trap the change event). Is
there a simple way to do this? Something like:

Dim sh as MSForms.Spinbutton (OR OLEObject)
Set sh = Sheets("Overview").Shapes("Group 447").GroupItems(2)


How about:

Dim sh as MSForms.Spinbutton
Set sh = Sheets("Overview").Shapes("Group 447") _
.GroupItems(2).OLEObject.Object

Regards

Stephen Bullen
Microsoft MVP - Excel
www.BMSLtd.co.uk