J
June Macleod
Microsoft Excel 2003
I have created a button on a spreadsheet using the following code
ActiveSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1",
Link:=False _
, DisplayAsIcon:=False, Left:=147, Top:=27.75, Width:=145.5,
Height:= _
33).Select
ActiveSheet.Shapes("CommandButton1").Name = "cmdButton"
but when I try and set a caption for the button using:
ActiveSheet.Shapes("CommandButton1").caption = "Hello World" it tells me
that the
"Object doesn't support this object or method"
When I try and record a macro to change the caption I end up with:
ActiveSheet.Shapes("CommandButton1").Select
Selection.Verb Verb:=xlPrimary
which frankly, I don't understand.
Can anyone help me here and tell me how to apply a caption to my button.
Many thanks
June
I have created a button on a spreadsheet using the following code
ActiveSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1",
Link:=False _
, DisplayAsIcon:=False, Left:=147, Top:=27.75, Width:=145.5,
Height:= _
33).Select
ActiveSheet.Shapes("CommandButton1").Name = "cmdButton"
but when I try and set a caption for the button using:
ActiveSheet.Shapes("CommandButton1").caption = "Hello World" it tells me
that the
"Object doesn't support this object or method"
When I try and record a macro to change the caption I end up with:
ActiveSheet.Shapes("CommandButton1").Select
Selection.Verb Verb:=xlPrimary
which frankly, I don't understand.
Can anyone help me here and tell me how to apply a caption to my button.
Many thanks
June