From: Martin D on 26 Jan 2010 08:07 I need to change the colour of a CELL in a word form depending on the seletion of a Dropdown form called "Select Level" which provides 4 differing levels to choose from. Level 1 = Platinum Level 2 = Gold Level 3 = Silver Level 4 = Bronze And i Wish to change the colour of cells further down the form to those colours specified against each level. I believe that I may need touse a macro to do this, but have never actually used one before and do not even know how to start (Complete Novice in Macro) so would need instructions of how to input the macro if anyone is kind enough to provide me with one. Many thanks in advance -- Regards Martin D
From: Graham Mayor on 26 Jan 2010 09:37 You would need a macro like the following stored in the document template http://www.gmayor.com/installing_macro.htm and run on exit from the dropdown form field. The example colours row1 column1 and row3 column 1 in Table 1 with the colours shown Sub ColorCells() Dim oFld As FormFields With ActiveDocument If .ProtectionType <> wdNoProtection Then .Unprotect Password:="" End If Set oFld = .FormFields Select Case oFld("SelectLevel").Result Case Is = "Platinum" .Tables(1).Cell(1, 1).Range.Shading.BackgroundPatternColor = wdColorGray15 .Tables(1).Cell(3, 1).Range.Shading.BackgroundPatternColor = wdColorGray15 Case Is = "Gold" .Tables(1).Cell(1, 1).Range.Shading.BackgroundPatternColor = wdColorLightYellow .Tables(1).Cell(3, 1).Range.Shading.BackgroundPatternColor = wdColorLightYellow Case Is = "Silver" .Tables(1).Cell(1, 1).Range.Shading.BackgroundPatternColor = wdColorGray25 .Tables(1).Cell(3, 1).Range.Shading.BackgroundPatternColor = wdColorGray25 Case Is = "Bronze" .Tables(1).Cell(1, 1).Range.Shading.BackgroundPatternColor = wdColorLightOrange .Tables(1).Cell(3, 1).Range.Shading.BackgroundPatternColor = wdColorLightOrange End Select .Protect _ Type:=wdAllowOnlyFormFields, _ NoReset:=True, _ Password:="" End With End Sub -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <>><<> "Martin D" <MartinD(a)discussions.microsoft.com> wrote in message news:DB8E02E1-5BB8-4705-896A-0733A4400ABF(a)microsoft.com... >I need to change the colour of a CELL in a word form depending on the > seletion of a Dropdown form called "Select Level" which provides 4 > differing > levels to choose from. > Level 1 = Platinum > Level 2 = Gold > Level 3 = Silver > Level 4 = Bronze > And i Wish to change the colour of cells further down the form to those > colours specified against each level. I believe that I may need touse a > macro > to do this, but have never actually used one before and do not even know > how > to start (Complete Novice in Macro) so would need instructions of how to > input the macro if anyone is kind enough to provide me with one. > > Many thanks in advance > -- > Regards > Martin D
|
Pages: 1 Prev: Difference range between ContentControlRichText & ContentControlGr Next: Macro use |