Command Buttons Location

P

pontiy

When I am creating a new button I have a chance of making it any size
and place it wherever I want to:

ActiveSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1",
Link:=False, DisplayAsIcon:=False, Left:=413.25, Top:=48.75, Width:=72,
Height:=24).Select


I can also move it with respect to its location:

With Worksheets("Sheet1")
Set Button = .OLEObjects("CommandButton1")
ActiveSheet.Shapes("CommandButton1").Select
Selection.ShapeRange.IncrementLeft 100
Selection.ShapeRange.IncrementTop -200
End With

But how do I move it with respect to the original coordinates?

Thank you,
 
T

Tom Ogilvy

With Worksheets("Sheet1")
Dim b as OleObject
Set b = .OLEObjects("CommandButton1")
b.Top = b.top + 10
b.Left = b.Left + 1
End With

also width and Height properties.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top