J
Jacques
I have several shapes that I would like to programmatically change colors. I
have 4 shapes and when I used the Tools - Macro record a new macro I got the
following:
Dim UndoScopeID1 As Long
UndoScopeID1 = Application.BeginUndoScope("Fill Color")
Application.ActiveWindow.Page.Shapes.ItemFromID(16).CellsSRC(visSectionObject, visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(255,255,0))"
Application.ActiveWindow.Page.Shapes.ItemFromID(16).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.ActiveWindow.Page.Shapes.ItemFromID(16).Shapes.ItemFromID(20).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(255,255,0))"
Application.ActiveWindow.Page.Shapes.ItemFromID(16).Shapes.ItemFromID(20).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.ActiveWindow.Page.Shapes.ItemFromID(16).Shapes.ItemFromID(19).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(255,255,0))"
Application.ActiveWindow.Page.Shapes.ItemFromID(16).Shapes.ItemFromID(19).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.ActiveWindow.Page.Shapes.ItemFromID(16).Shapes.ItemFromID(18).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(255,255,0))"
Application.ActiveWindow.Page.Shapes.ItemFromID(16).Shapes.ItemFromID(18).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.EndUndoScope UndoScopeID1, True
Dim UndoScopeID2 As Long
UndoScopeID2 = Application.BeginUndoScope("Fill Color")
Application.ActiveWindow.Page.Shapes.ItemFromID(11).CellsSRC(visSectionObject, visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(255,0,0))"
Application.ActiveWindow.Page.Shapes.ItemFromID(11).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.ActiveWindow.Page.Shapes.ItemFromID(11).Shapes.ItemFromID(15).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(255,0,0))"
Application.ActiveWindow.Page.Shapes.ItemFromID(11).Shapes.ItemFromID(15).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.ActiveWindow.Page.Shapes.ItemFromID(11).Shapes.ItemFromID(14).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(255,0,0))"
Application.ActiveWindow.Page.Shapes.ItemFromID(11).Shapes.ItemFromID(14).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.ActiveWindow.Page.Shapes.ItemFromID(11).Shapes.ItemFromID(13).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(255,0,0))"
Application.ActiveWindow.Page.Shapes.ItemFromID(11).Shapes.ItemFromID(13).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.EndUndoScope UndoScopeID2, True
Dim UndoScopeID3 As Long
UndoScopeID3 = Application.BeginUndoScope("Fill Color")
Application.ActiveWindow.Page.Shapes.ItemFromID(6).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(0,112,192))"
Application.ActiveWindow.Page.Shapes.ItemFromID(6).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.ActiveWindow.Page.Shapes.ItemFromID(6).Shapes.ItemFromID(10).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(0,112,192))"
Application.ActiveWindow.Page.Shapes.ItemFromID(6).Shapes.ItemFromID(10).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.ActiveWindow.Page.Shapes.ItemFromID(6).Shapes.ItemFromID(9).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(0,112,192))"
Application.ActiveWindow.Page.Shapes.ItemFromID(6).Shapes.ItemFromID(9).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.ActiveWindow.Page.Shapes.ItemFromID(6).Shapes.ItemFromID(8).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(0,112,192))"
Application.ActiveWindow.Page.Shapes.ItemFromID(6).Shapes.ItemFromID(8).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.EndUndoScope UndoScopeID3, True
Dim UndoScopeID4 As Long
UndoScopeID4 = Application.BeginUndoScope("Fill Color")
Application.ActiveWindow.Page.Shapes.ItemFromID(1).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(0,176,80))"
Application.ActiveWindow.Page.Shapes.ItemFromID(1).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.ActiveWindow.Page.Shapes.ItemFromID(1).Shapes.ItemFromID(5).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(0,176,80))"
Application.ActiveWindow.Page.Shapes.ItemFromID(1).Shapes.ItemFromID(5).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.ActiveWindow.Page.Shapes.ItemFromID(1).Shapes.ItemFromID(4).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(0,176,80))"
Application.ActiveWindow.Page.Shapes.ItemFromID(1).Shapes.ItemFromID(4).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.ActiveWindow.Page.Shapes.ItemFromID(1).Shapes.ItemFromID(3).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(0,176,80))"
Application.ActiveWindow.Page.Shapes.ItemFromID(1).Shapes.ItemFromID(3).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.EndUndoScope UndoScopeID4, True
I would normaly reference my shapes by using shape(#).... but to change
colors it seems I need to use the itemfromID.
Does anyone know how I can get the itemfromid for a shape or another way of
changing the color of a shape?
have 4 shapes and when I used the Tools - Macro record a new macro I got the
following:
Dim UndoScopeID1 As Long
UndoScopeID1 = Application.BeginUndoScope("Fill Color")
Application.ActiveWindow.Page.Shapes.ItemFromID(16).CellsSRC(visSectionObject, visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(255,255,0))"
Application.ActiveWindow.Page.Shapes.ItemFromID(16).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.ActiveWindow.Page.Shapes.ItemFromID(16).Shapes.ItemFromID(20).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(255,255,0))"
Application.ActiveWindow.Page.Shapes.ItemFromID(16).Shapes.ItemFromID(20).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.ActiveWindow.Page.Shapes.ItemFromID(16).Shapes.ItemFromID(19).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(255,255,0))"
Application.ActiveWindow.Page.Shapes.ItemFromID(16).Shapes.ItemFromID(19).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.ActiveWindow.Page.Shapes.ItemFromID(16).Shapes.ItemFromID(18).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(255,255,0))"
Application.ActiveWindow.Page.Shapes.ItemFromID(16).Shapes.ItemFromID(18).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.EndUndoScope UndoScopeID1, True
Dim UndoScopeID2 As Long
UndoScopeID2 = Application.BeginUndoScope("Fill Color")
Application.ActiveWindow.Page.Shapes.ItemFromID(11).CellsSRC(visSectionObject, visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(255,0,0))"
Application.ActiveWindow.Page.Shapes.ItemFromID(11).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.ActiveWindow.Page.Shapes.ItemFromID(11).Shapes.ItemFromID(15).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(255,0,0))"
Application.ActiveWindow.Page.Shapes.ItemFromID(11).Shapes.ItemFromID(15).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.ActiveWindow.Page.Shapes.ItemFromID(11).Shapes.ItemFromID(14).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(255,0,0))"
Application.ActiveWindow.Page.Shapes.ItemFromID(11).Shapes.ItemFromID(14).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.ActiveWindow.Page.Shapes.ItemFromID(11).Shapes.ItemFromID(13).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(255,0,0))"
Application.ActiveWindow.Page.Shapes.ItemFromID(11).Shapes.ItemFromID(13).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.EndUndoScope UndoScopeID2, True
Dim UndoScopeID3 As Long
UndoScopeID3 = Application.BeginUndoScope("Fill Color")
Application.ActiveWindow.Page.Shapes.ItemFromID(6).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(0,112,192))"
Application.ActiveWindow.Page.Shapes.ItemFromID(6).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.ActiveWindow.Page.Shapes.ItemFromID(6).Shapes.ItemFromID(10).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(0,112,192))"
Application.ActiveWindow.Page.Shapes.ItemFromID(6).Shapes.ItemFromID(10).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.ActiveWindow.Page.Shapes.ItemFromID(6).Shapes.ItemFromID(9).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(0,112,192))"
Application.ActiveWindow.Page.Shapes.ItemFromID(6).Shapes.ItemFromID(9).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.ActiveWindow.Page.Shapes.ItemFromID(6).Shapes.ItemFromID(8).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(0,112,192))"
Application.ActiveWindow.Page.Shapes.ItemFromID(6).Shapes.ItemFromID(8).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.EndUndoScope UndoScopeID3, True
Dim UndoScopeID4 As Long
UndoScopeID4 = Application.BeginUndoScope("Fill Color")
Application.ActiveWindow.Page.Shapes.ItemFromID(1).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(0,176,80))"
Application.ActiveWindow.Page.Shapes.ItemFromID(1).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.ActiveWindow.Page.Shapes.ItemFromID(1).Shapes.ItemFromID(5).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(0,176,80))"
Application.ActiveWindow.Page.Shapes.ItemFromID(1).Shapes.ItemFromID(5).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.ActiveWindow.Page.Shapes.ItemFromID(1).Shapes.ItemFromID(4).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(0,176,80))"
Application.ActiveWindow.Page.Shapes.ItemFromID(1).Shapes.ItemFromID(4).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.ActiveWindow.Page.Shapes.ItemFromID(1).Shapes.ItemFromID(3).CellsSRC(visSectionObject,
visRowFill, visFillForegnd).FormulaU = "THEMEGUARD(RGB(0,176,80))"
Application.ActiveWindow.Page.Shapes.ItemFromID(1).Shapes.ItemFromID(3).CellsSRC(visSectionObject,
visRowFill, visFillBkgnd).FormulaU =
"THEMEGUARD(SHADE(FillForegnd,LUMDIFF(THEME(""FillColor""),THEME(""FillColor2""))))"
Application.EndUndoScope UndoScopeID4, True
I would normaly reference my shapes by using shape(#).... but to change
colors it seems I need to use the itemfromID.
Does anyone know how I can get the itemfromid for a shape or another way of
changing the color of a shape?