Consulting

Results 1 to 6 of 6

Thread: Printing on different paper

  1. #1

    Printing on different paper

    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.

  2. #2
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    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.

  3. #3
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    ....
    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?
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  4. #4
    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.

  5. #5
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    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.

  6. #6
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    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!)
    [vba]
    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

    [/vba]
    Here's a small sample.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •