Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi - I have a workbook with multiple sheets - each having a few shapes
on it. I want to change the color of the fill and line for each one. My code works ok if I run it on just one sheet, but if I try and run it on one sheet right after the other (with a subroutine calling this sub twice), it gives me the "Object doesn't support the property or method" error. Sometimes this even happens if I run the macro twice in a row manually, sometimes it doesn't. I am seriously at my wits end....can someone please help? Thanks! Here is the code I am bombing out on...."Selection.ShapeRange.Fill.ForeColor.SchemeC olor = 16" (or whichever case it is on) For Each sh In myDocument.Shapes sh.Select If sh.Type = 2 Then Select Case colorscheme Case "OcOl" Selection.ShapeRange.Fill.ForeColor.SchemeColor = 16 Selection.ShapeRange.Line.ForeColor.SchemeColor = 16 With Selection.Characters.Font .Name = "Arial" .FontStyle = "Regular" .Size = 10 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = fontcolor End With Case "BoTe" Selection.ShapeRange.Fill.ForeColor.SchemeColor = 34 Selection.ShapeRange.Line.ForeColor.SchemeColor = 34 With Selection.Characters.Font .Name = "Arial" .FontStyle = "Regular" .Size = 10 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = fontcolor End With Case "EaTe" Selection.ShapeRange.Fill.ForeColor.SchemeColor = 34 Selection.ShapeRange.Line.ForeColor.SchemeColor = 34 With Selection.Characters.Font .Name = "Arial" .FontStyle = "Regular" .Size = 10 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = fontcolor End With Case "BoEa" Selection.ShapeRange.Fill.ForeColor.SchemeColor = 35 Selection.ShapeRange.Line.ForeColor.SchemeColor = 35 With Selection.Characters.Font .Name = "Arial" .FontStyle = "Regular" .Size = 10 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = fontcolor End With Case Else 'Olive-Ocean is default Selection.ShapeRange.Fill.ForeColor.SchemeColor = 1 Selection.ShapeRange.Line.ForeColor.SchemeColor = 1 With Selection.Characters.Font .Name = "Arial" .FontStyle = "Regular" .Size = 10 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = fontcolor End With End Select End If Next |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Change multiple worksheets at one time to print in color | Excel Discussion (Misc queries) | |||
How do i change the size of multiple shapes at the same time? | Excel Discussion (Misc queries) | |||
Loop to change cell color based on found value? | Excel Programming | |||
Summing loop for multiple worksheets | Excel Programming | |||
PROB: Grouping Shapes With An Array Loop | Excel Programming |