PDA

View Full Version : Solved: Working with Shapes



leal72
09-28-2009, 09:47 AM
I've added a shape with code but now I would like to format it, tried to see what was happening by recording a macro but it did not give me anything useful

I want to assign a macro to it.

this is how I added the macro using code

With ActiveSheet.Shapes.AddShape(msoShapeRoundedRectangle, _
ActiveCell.Left, ActiveCell.Top, 95, ActiveCell.Height).Fill
.ForeColor.RGB = RGB(128, 0, 0)
.Parent.Name = "MacroRun"
End With

xld
09-28-2009, 10:35 AM
Dim shp As Shape

Set shp = ActiveSheet.Shapes.AddShape( _
msoShapeRoundedRectangle, _
ActiveCell.Left, _
ActiveCell.Top, _
95, _
ActiveCell.Height)
shp.Fill.ForeColor.RGB = RGB(128, 0, 0)
shp.OnAction = "MacroRun"

leal72
09-28-2009, 11:56 AM
Thank you!