NewOrderFac33
Well-known Member
- Joined
- Sep 26, 2011
- Messages
- 1,283
- Office Version
- 2016
- 2010
- Platform
- Windows
Good afternoon,
I have two grouped objects, a round cornered rectangle and a star, both of which have a fill colour and a border colour.
I want, via VBA obviously to be able to alter the colour of the fill and the border of the rectangle, without altering the fill and the border of the star.
I can't refer to the rectangle and the star by their individual object names, as there are multiple occurrences of grouped rectangles/stars on which I want to perform the operation, having selected the group previously.
Here's what I currently have, but when I run it, it changes the colours of both rectangle and star - I need to be able to just change the rectangle.
Can any of you good folks help?
As always, thanks in advance.
Pete
I have two grouped objects, a round cornered rectangle and a star, both of which have a fill colour and a border colour.
I want, via VBA obviously to be able to alter the colour of the fill and the border of the rectangle, without altering the fill and the border of the star.
I can't refer to the rectangle and the star by their individual object names, as there are multiple occurrences of grouped rectangles/stars on which I want to perform the operation, having selected the group previously.
Here's what I currently have, but when I run it, it changes the colours of both rectangle and star - I need to be able to just change the rectangle.
Can any of you good folks help?
As always, thanks in advance.
Pete
Code:
Sub InProgress_High()
Dim ActiveShape As Shape
Dim UserSelection As Variant
Set UserSelection = ActiveWindow.Selection
On Error GoTo NoShapeSelected
Set ActiveShape = ActiveSheet.Shapes(UserSelection.Name)
'On Error Resume Next
'Pastel Red fill
With Selection.ShapeRange.Fill
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorAccent2
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0.400000006
.Transparency = 0
.Solid
End With
'Black text
With Selection.ShapeRange.TextFrame2.TextRange.Font.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 0, 0)
.Solid
End With
'Bright Red Border
With Selection.ShapeRange.Line
.Visible = msoTrue
.ForeColor.RGB = RGB(255, 0, 0)
.Transparency = 0
.Weight = 3
End With
Exit Sub
NoShapeSelected:
MsgBox "You do not have a shape selected!"
End Sub
Last edited: