PDA

View Full Version : Printing on different paper



cssamerican
10-16-2006, 10:14 AM
I have a job where every other page is to be printed on letterhead. I would like to have a piece of code that goes in and changes the page set-up for every odd page, so that it will print on letterhead. The problem I am running is I do not know how to select specific pages in word through code. Normaly I just write code for excel and in it you can access specific sheets, can you access specific pages in word? If not how do you approach this problem? thanks for the help.

fumei
10-17-2006, 01:40 AM
Oh boy...this discussion again.

There are no "pages" in Word. Not really. Pages are calculated by a repagination method. They are not permanent "things", like a individual sheet in Excel.

Please be very very clear as to to what you want to happen. You state that you want to change the page setup for every odd page. Do you mean this literally? If so, what exactly are the changes to the page setup?

This is actually a separate issue from printing the different pages. I take it you want to:

1. do this as one print job
2. you are going to use different paper trays - one for even pages, and one for odd pages...assuming by "letterhead" you are meaning paper with a letterhead already printed on it.

This is a little tricky.

But then....maybe you are not talking about a letterhead already printed. Maybe you are talking about letterhead being IN the document...in which case you would need a different solution.

See what I mean? You need to always give very very precise descriptions of what you want.

In any case, it is not trivial accessing specific pages in Word. It does not look at "page" quite the way you would think.

mdmackillop
10-17-2006, 05:48 AM
....
3. Is your document in Sections eg the result of a mailmerge?
4. If preprinted, where are your pre-printed areas. Top, Sides, Bottom? and is your alternate page blank?

cssamerican
10-17-2006, 12:57 PM
Wow! This is going to much more complicated than I first thought.

I would like to print it as one print job.

I am going to use one paper tray for odd pages and one for even pages.

The odd page would be printed on a pre-printed letterhead, while the even ones would be printed on plain paper.

I am not that familar with sections, but it is a mailmerge. Both pages have data and both pages have variable data as a result of the mailmerge.

The pre-printed letterhead area would be at the top and bottom of the page.

I hope this covers everything.

fumei
10-17-2006, 01:25 PM
Yes...it will be a bit complicated. I am not sure it can even be done really as one print job. It CAN be done essentially printing one page at a time. ONE macro, but separate print jobs - one per page.

mdmackillop
10-17-2006, 04:15 PM
OK
I'm guessing that you're creating two page mailmerge documents, as it's not usual to print following pages on headed paper. I use the following code to set the printer trays in the merged document. In my office, we have a non-printing area on the right, so I use a rectangle (no border) to keep the print out of that area. You can use similar for top and bottom if necessary. (OK Gerry its cheating, but it works!)

Sub SetPage() 'Merge Letter
For Each Sec In ActiveDocument.Sections
With Selection.PageSetup
.FirstPageTray = Tray1
.OtherPagesTray = Tray3
End With
Selection.GoTo What:=wdGoToSection, Which:=wdGoToNext, Count:=1, Name:=""
Next Sec
Selection.HomeKey Unit:=wdStory
End Sub


Here's a small sample.