Thanks dave, that worked fine. However, trying to build on that I got
stumped right away

to change the name I tried adding :
OLEObj.Object.Name = "testbx"
right after
OLEObj.Object.Caption = "testbx"
and I get a runtime error 438 "Object doesn't support this property or
method"
I tried a few other items that I thought were valid properties but got
similar results. it seems like there are "catagories" of properties
for controls and the help is isnt doing my in clearifying that...
Can I change the name and other properties using the method you
demonstriated or is that limited to the Caption?
Is there a good reference on this topic?
thanks
Robert
Dave Peterson wrote:
> This worked ok for me:
>
> Option Explicit
> Public Sub InsertChkBx1()
> Dim OLEObj As OLEObject
>
> 'insert checkbox at cell B2
> With ActiveSheet
> Set OLEObj = .OLEObjects.Add(classtype:="Forms.CheckBox.1", _
> Left:=48.75, Top:=13.5, Height:=11.25, Width:=46.5)
> OLEObj.Object.Caption = "testbx"
> End With
>
> End Sub
>
> (E-Mail Removed) wrote:
> >
> > I'm trying to add a control to a worksheet and then modify its
> > parameters. To learn how to do this I have the following code:
> >
> > Option Explicit
> > Public Sub InsertChkBx1()
> > 'insert checkbox at cell B2
> > ActiveSheet.OLEObjects.Add classtype:="Forms.CheckBox.1", _
> > Left:=48.75, Top:=13.5, Height:=11.25, Width:=46.5
> > End Sub
> >
> > Public Sub renameChkBx()
> > Sheet1.CheckBox1.Caption = "testbx"
> > End Sub
> >
> > Running Sub InsertChkBx1 and then renameChkBx works fine.
> >
> > The next step is run them from one piece of code...
> >
> > Public Sub InsertChkBx1()
> >
> > 'insert checkbox at cell B2
> > ActiveSheet.OLEObjects.Add classtype:="Forms.CheckBox.1", _
> > Left:=48.75, Top:=13.5, Height:=11.25, Width:=46.5
> >
> > Sheet1.CheckBox1.Caption = "testbx"
> >
> > End Sub
> >
> > But I get a compile error highlighting "checkBox1" - Method or
> > data member not found. Probably because there is no checkbox yet. I
> > decided to keep them separate and just call the second procedure from
> > the first...
> >
> > Public Sub InsertChkBx1()
> >
> > 'insert checkbox at cell B2
> > ActiveSheet.OLEObjects.Add classtype:="Forms.CheckBox.1", _
> > Left:=48.75, Top:=13.5, Height:=11.25, Width:=46.5
> >
> > renameChkBx
> >
> > End Sub
> >
> > Public Sub renameChkBx()
> >
> > Sheet1.CheckBox1.Caption = "testbx"
> >
> > End Sub
> >
> > But I get the same error just down in the second procedure.
> >
> > Any help will be greatly appreciated
> > Robert
>
> --
>
> Dave Peterson