Why doesn't Office Word 2007 understand "print data only for forms

E

EJL/PDX

I just want the data only to print nothing more and nothing less, when I
select the "print data ONLY for forms" option. Previous versions have no
issue with that. 2007 wants to print the borders I have established on my
template. I understand I could change "turn off" my borders, but I would
hope with the option I have selected it does what it says it will do.
 
D

Doug Robbins - Word MVP

Put the following code in a template that you save in the Word startup
folder and it will set the colour of the borders of a table to white in a
document that is protected for filling in forms and for which formsdata only
is being printed and then change the colour back to automatic after the
print has been executed.

As the template will then be treated as an add-in and as the names of the
macros are the same as the names of the built-in Word commands for printing,
you do not need to do anything special to run the code. Just use the normal
print commands.

Sub FilePrint()
With ActiveDocument
If .ProtectionType = wdAllowonlyFormfiels And .PrintFormsData = True
Then
PrintForm
Else
Dialogs(wdDialogFilePrint).Show
End If
End With
End Sub

Sub FilePrintDefault()
With ActiveDocument
If .ProtectionType = wdAllowonlyFormfiels And .PrintFormsData = True
Then
PrintForm
Else
.PrintOut
End If
End With
End Sub

Function PrintForm()
Dim atable As Table
Application.ScreenUpdating = False
With ActiveDocument
.Unprotect
For Each atable In .Tables
With atable.Borders
.InsideColor = wdColorWhite
.OutsideColor = wdColorWhite
End With
Next atable
.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
.PrintFormsData = True
.PrintOut
.Unprotect
For Each atable In .Tables
With atable.Borders
.InsideColor = wdColorAutomatic
.OutsideColor = wdColorAutomatic
End With
Next atable
.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End With
Application.ScreenUpdating = True
End Function

See the article "What do I do with macros sent to me by other newsgroup
readers to help me out?†at:
http://www.word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm


--
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, originally posted via msnews.microsoft.com
 

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