Dim sr1 as shaperange
Dim palVal as string
palVal = RGB(28, 18, 205) ' Here is my string. I put it here so it's easy to change per various scenarios that will be below. but in this case I only used one.
Set sr1 = ActiveSelection.Shapes.FindShapes(Query:="@fill.color= RGB(28,18,205)") ' Here is the original setup but I want to replace this with palVal like below
Set sr1 = ActiveSelection.Shapes.FindShapes(Query:="@fill.color= 'palVal'") ' So i'd like to pull the value by using this key word / string "palVal"
But strings and CQL are confusing. I want to pull by value. But by using a keyword to make changing all the values easier. Can anyone assist me?
Here is the whole Code In the event it may help you help me :)
Sub royalBlue403Val()
Dim sr1 As ShapeRange, sr2 As ShapeRange, sr3 As ShapeRangeDim ff As FountainFillDim i As Long
Dim palVal$Dim R$, G$, B$
palVal$ = RGB(28, 18, 205) ' My String im trying to use in CQL
R = 0G = 70B = 145
Set sr1 = ActiveSelection.Shapes.FindShapes(Query:="@fill.color= RGB(28,18,205)") <- Here I want to replace w/string "palVal" sr1.ApplyUniformFill CreateRGBColor(R, G, B)
Set sr2 = ActiveSelectionRange.Shapes.FindShapes(Query:="@outline.color =RGB(28,18,205)") <- Here I want to replace w/string"palVal" sr2.SetOutlineProperties Color:=CreateRGBColor(R, G, B)
Set sr3 = ActiveSelectionRange.Shapes.FindShapes(Query:="@fill.fountain.colors.find('403 - Royal Blue')") < How do I change this from Name to Value? Since its a Fountain?
For Each s In sr3.Shapes Set ff = s.fill.Fountain
For i = 0 To ff.Colors.Count - 1 If ff.Colors(i).Color.Name = "403 - Royal Blue" Then If ff.Colors(i).Color.rgbvalue = palVal Then ' palVal string worked here just fine. ff.Colors(i).Color.RGBAssign R, G, B , ' this string worked! End If End If Next i Next sEnd Sub
My strings just don't work for the CQL Portion... It's a little confusing.
Sub royalBlue403Val()Dim sr1 As ShapeRange, sr2 As ShapeRange, sr3 As ShapeRangeDim ff As FountainFillDim i As Long
Dim palVal$, q$Dim R$, G$, B$
palVal$ = "RGB(28,18,205)" 'My String im trying to use in CQL
Set sr1 = ActiveSelection.Shapes.FindShapes(Query:="@fill.color = " & palVal & "")sr1.ApplyUniformFill CreateRGBColor(R, G, B)
Set sr2 = ActiveSelectionRange.Shapes.FindShapes(Query:="@outline.color = " & palVal & "")sr2.SetOutlineProperties Color:=CreateRGBColor(R, G, B)
Set sr3 = ActiveSelectionRange.Shapes.FindShapes(Query:="@fill.type = 'fountain'") For Each s In sr3.Shapes Set ff = s.Fill.Fountain For i = 0 To ff.Colors.Count + 1 If ff.Colors(i).Color.Name = "Deep Blue" Then ff.Colors(i).Color.RGBAssign R, G, B If ff.Colors(i).Color.ToString = palVal Then ff.Colors(i).Color.RGBAssign R, G, B Next i Next sEnd Sub