Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.word.tables
|
|||
|
|||
![]()
The shading applied by the macro is exactly the same as the shading you
could apply from the Borders and Shading dialog. It will print. There is no need to do anything else. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. Aliza Berger-Cooper wrote: Jay, Thanks so much for your helpful answer. I have a followup question. I want the user to be able to print the form (partially completed) with the blank fields shaded and the filled fields unshaded (accomplished as per your instructions). The Microsoft site says this: To add shading to a printed form, select the form field you want to emphasize, and then click Borders and Shading (Format menu). On the Shading tab, select the shading options you want. Will this work in conjunction with your advice? TIA again. Aliza in Jerusalem Jay Freedman wrote: For text form fields, you can put this macro in the form template(change the 26-Jan-10 For text form fields, you can put this macro in the form template (change the colors as desired): Sub FormExit() Dim fld As FormField ActiveDocument.Unprotect If Selection.Bookmarks.Count 0 Then Set fld = ActiveDocument.FormFields( _ Selection.Bookmarks( _ Selection.Bookmarks.Count).Name) End If If Trim(fld.Result) = "" Then fld.Range.Shading _ .BackgroundPatternColor = wdColorYellow Else fld.Range.Shading _ .BackgroundPatternColor = wdColorWhite End If ActiveDocument.Protect Type:=wdAllowOnlyFormFields, _ NoReset:=True End Sub Assign this macro as the exit macro of each text form field. To have each new document start with the fields colored, also put in this macro: Sub AutoNew() Dim fld As FormField With ActiveDocument .Unprotect For Each fld In .FormFields fld.Range.Shading.BackgroundPatternColor = _ wdColorYellow Next .Protect Type:=wdAllowOnlyFormFields End With End Sub This sort of thing works for form fields because you can assign an exit macro that runs automatically when you exit the field. There is no such thing for a table cell that does not contain a form field. Although it would be possible to use an application event handler for the WindowSelectionChange event to change the background color of a table cell, its behavior is not very nice. See http://www.eggheadcafe.com/software/...nd-to-red.aspx for a discussion. |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Display width of text form field before being filled in. | Microsoft Word Help | |||
how do you underline a blank space that is to be filled in? | Microsoft Word Help | |||
Shaded Form Field - shorter | Microsoft Word Help | |||
How to lock text field so form not changed when filled out? | Microsoft Word Help | |||
How do I put blank lines in a document to be filled in on the doc. | Microsoft Word Help |