Prev: Word 2007 - import comments from a different file
Next: Change capitalized words to capitalized words and bold
From: EJL/PDX on 19 Apr 2010 20:48 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.
From: Doug Robbins - Word MVP on 19 Apr 2010 23:38
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 "EJL/PDX" <EJL/PDX(a)discussions.microsoft.com> wrote in message news:91F88FE2-0978-4335-A90E-3D9D4B820758(a)microsoft.com... > 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. |