Re: Conditional format a table cell (background colour) by Doug
Doug
Tue Aug 16 16:04:07 CDT 2005
Run a macro containing the following code (modified as necesssary for the
bookmark name assigned to the formfield) on exit from the formfield into
which the date is entered:
With ActiveDocument
.Unprotect
If .FormFields("Text1").result < Now Then
.FormFields("Text1").Range.Cells(1).Shading.BackgroundPatternColor =
wdColorRed
Else
.FormFields("Text1").Range.Cells(1).Shading.BackgroundPatternColor =
wdColorAutomatic
End If
.Protect wdAllowOnlyFormFields, NoReset
End With
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
"Paul Brown" <paul.brown25@ntlworld.com> wrote in message
news:F5sMe.9418$CM.7031@newsfe7-win.ntli.net...
> Hello all,
>
> Very little experience with Macros but I have created a project plan
> template containing various form fields and any number of macros (mainly
> via the recorder with a bit of code tweaking). One of the text fields in
> the table is a due date. Via VBA is there any way to highlight the date
> cell or even the entire row by changing the background colour red when the
> date is overdue? I guess this would be quite straight forward in Excel via
> Conditional formating but I would really like to do it in Word.
>
> Any help appreciated.
>
> Thanks.
>
> Paul.
>