VBA code to shade rows in Word table based selecting a radio butto

P

Peter

I'd like to have a Word form for a checklist that people need to do before
completing a task.

Each row would have an item that the user would check then select a radio
button to say it was OK or that it was NOT OK. Rows where it was NOT OK would
be shaded red and rows that were OK would be shaded green. Rows where the
test had not been done would remain white.

What VBA code would I need to add to the document to achieve this?

Any assistance would be very gratefully received.

PeterEvans
 
D

Doug Robbins - Word MVP

Something along the lines of:

Private Sub optNotOK_Click()
If optNo.Value = True Then
Selection.Rows(1).Range.Shading.BackgroundPatternColor = wdColorRed
Else
Selection.Rows(1).Range.Shading.BackgroundPatternColor = wdColorGreen
End If
End Sub
Private Sub optOK_Click()
If optYes.Value = True Then
Selection.Rows(1).Range.Shading.BackgroundPatternColor = wdColorGreen
Else
Selection.Rows(1).Range.Shading.BackgroundPatternColor = wdColorRed
End If
End Sub


--
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top