Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Do not print blank form fields
I have made Word documents for test reports. In conclusion there are free
text and drop down form fields. How do I remove spacing on the printed verison from form fields that are left blank? |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Do not print blank form fields
You need a macro
Dim i As Integer Dim bProtected As Boolean Dim bHidden As Boolean Dim sPassword As String sPassword = "" bHidden = ActiveWindow.View.ShowHiddenText ActiveWindow.View.ShowHiddenText = False If ActiveDocument.ProtectionType wdNoProtection Then bProtected = True ActiveDocument.Unprotect Password:=sPassword End If With ActiveDocument For i = .FormFields.Count To 1 Step -1 If Len(.FormFields(i).Result) = 0 Then 'Hide the field .FormFields(i).Range.Font.Hidden = True 'or Hide the paragraph containing the field '.FormFields(i).Range.Paragraphs(1) _ .Range.Font.Hidden = True End If Next i End With If bProtected = True Then ActiveDocument.Protect _ Type:=wdAllowOnlyFormFields, NoReset:=True, _ Password:=sPassword End If ActiveWindow.View.ShowHiddenText = bHidden http://www.gmayor.com/installing_macro.htm -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Jack F wrote: I have made Word documents for test reports. In conclusion there are free text and drop down form fields. How do I remove spacing on the printed verison from form fields that are left blank? |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Do not print blank form fields
Oops! ( Forgot to include the command to print the document with the
fields hidden Dim i As Integer Dim bProtected As Boolean Dim bHidden As Boolean Dim sPassword As String sPassword = "" bHidden = ActiveWindow.View.ShowHiddenText ActiveWindow.View.ShowHiddenText = False With ActiveDocument If .ProtectionType wdNoProtection Then bProtected = True .Unprotect Password:=sPassword End If For i = .FormFields.Count To 1 Step -1 If Len(.FormFields(i).Result) = 0 Then 'Hide the field .FormFields(i).Range.Font.Hidden = True 'or Hide the paragraph containing the field '.FormFields(i).Range.Paragraphs(1) _ .Range.Font.Hidden = True End If Next i If bProtected = True Then .Protect _ Type:=wdAllowOnlyFormFields, _ NoReset:=True, _ Password:=sPassword End If .PrintOut End With ActiveWindow.View.ShowHiddenText = bHidden -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Graham Mayor wrote: You need a macro Dim i As Integer Dim bProtected As Boolean Dim bHidden As Boolean Dim sPassword As String sPassword = "" bHidden = ActiveWindow.View.ShowHiddenText ActiveWindow.View.ShowHiddenText = False If ActiveDocument.ProtectionType wdNoProtection Then bProtected = True ActiveDocument.Unprotect Password:=sPassword End If With ActiveDocument For i = .FormFields.Count To 1 Step -1 If Len(.FormFields(i).Result) = 0 Then 'Hide the field .FormFields(i).Range.Font.Hidden = True 'or Hide the paragraph containing the field '.FormFields(i).Range.Paragraphs(1) _ .Range.Font.Hidden = True End If Next i End With If bProtected = True Then ActiveDocument.Protect _ Type:=wdAllowOnlyFormFields, NoReset:=True, _ Password:=sPassword End If ActiveWindow.View.ShowHiddenText = bHidden http://www.gmayor.com/installing_macro.htm Jack F wrote: I have made Word documents for test reports. In conclusion there are free text and drop down form fields. How do I remove spacing on the printed verison from form fields that are left blank? |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to I print only non-blank fields in Mail Merge? | Mailmerge | |||
Blank return for drop-down form fields | Microsoft Word Help | |||
Blank Merge Fields Still Print when told not to. | Mailmerge | |||
How to use mail merge to send out a form with blank text fields? | Mailmerge | |||
In mail merge I don't want to print blank fields | Mailmerge |