R
Roelvdh
Hi,
I can correctly put a command button over a cell, covering half of it.
I want to use the other half for entering a second command button, but the second one can not be added.
</code>
Sheets("Settings").Select
Set rng = ActiveSheet.Range("C10")
Set Obj1 = ActiveSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1", _
Link:=False, DisplayAsIcon:=False)
With Obj1
.Top = rng.Top
.Width = rng.Width / 2
.Left = rng.Left + .Width
.Height = rng.RowHeight * 2
.Object.Caption = "Return to Program"
End With
Set Obj2 = ActiveSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.2", _
Link:=False, DisplayAsIcon:=False)
With Obj2
.Top = rng.Top
.Left = rng.Left
.Width = rng.Width / 2
.Height = rng.RowHeight * 2
.Object.Caption = "Recycle"
End With
<code/>
What's wrong?
Roel
I can correctly put a command button over a cell, covering half of it.
I want to use the other half for entering a second command button, but the second one can not be added.
</code>
Sheets("Settings").Select
Set rng = ActiveSheet.Range("C10")
Set Obj1 = ActiveSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1", _
Link:=False, DisplayAsIcon:=False)
With Obj1
.Top = rng.Top
.Width = rng.Width / 2
.Left = rng.Left + .Width
.Height = rng.RowHeight * 2
.Object.Caption = "Return to Program"
End With
Set Obj2 = ActiveSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.2", _
Link:=False, DisplayAsIcon:=False)
With Obj2
.Top = rng.Top
.Left = rng.Left
.Width = rng.Width / 2
.Height = rng.RowHeight * 2
.Object.Caption = "Recycle"
End With
<code/>
What's wrong?
Roel