PDA

View Full Version : Print the data only in Word 2007 Form



dm75
07-21-2008, 12:59 PM
I created some forms in Word 2003 that were designed so when they were printed out only the data in the form would be printed .

With the launch of Word 2007, the ability to "Print data only for forms" was lost.

Over a year ago, I posted onto the Microsoft site asking if there was a workaround:


It appears there isn't.

So is there a way I could write some VBA to do this?

I have links to post with this request, but as this is my first post on this forum, I'm not able to do so :(

Thanks

CreganTur
07-21-2008, 01:42 PM
I have links to post with this request, but as this is my first post on this forum, I'm not able to do so

Just put them in as text- we can C&P them... we're not that lazy:whip

dm75
07-21-2008, 01:46 PM
Ok :)

Well this is the process I want to perform in Word 2007, as described in Word 2003.

office.microsoft.com/en-us/word/HP051895771033.aspx

This was my post on another forum asking for advice

pcreview.co.uk/forums/thread-3083318.php

macropod
07-21-2008, 11:35 PM
The code to do this would be something like:
With ActiveDocument
FmPrint = .PrintFormsData
.PrintFormsData = True
.PrintOut
.PrintFormsData = FmPrint
End WithThe user interface for this is still with us in Word 2007 - See under Office Button|Word Options > Advanced > When printing this document.

dm75
07-22-2008, 04:27 AM
Believe it or not, Word 2007 has the option in the Advanced page but it doesn't work even when set. It still prints the table borders out.

Thanks for posting the code.

I'm only a beginner at VBA but

I tried inserting it into a Sub and also my Active Document Module, but it didn't work.

Am I doing something wrong?

Cheers
Chris

macropod
07-22-2008, 04:49 AM
Hi Chris,

When you say 'it didn't work', what about it didn't work? Did you get an error message? Did you Dim the 'FmPrint' variable as a Boolean (ie Dim FmPrint As Boolean)?

dm75
07-22-2008, 04:51 AM
There was no error message, the table border just continued to print out as well as the data.

macropod
07-22-2008, 05:15 AM
Hi Chris,

OK, but when you say
I tried inserting it into a Sub and also my Active Document Module, but it didn't work.that doesn't imply that it works, but not the way you wanted.

Since the table borders seem to be an issue for you, why not simply turn them off. If you need them for other purposes, you could add some code to your 'print for forms' sub to turn them off before printing, then on again afterwards. This is quite easy if the borders are consistent, and the macro recorder will give you a good idea of how to go about it.

dm75
07-22-2008, 05:28 AM
You're right, the reason it didn't work is me probably not writing the code correctly.

I'm sure I can do this, I just haven't got too many skills in VBA.

Like you say though, recording a macro will probably be the easiest way.

I'll have another try.

The forms are quite complex with about 150 text form fields, that took many hours to create in Word. They are used to overprint 6 page forms.


Without the table border it's not as clear for the user how much room they have for address boxes etc.