Consulting

Results 1 to 5 of 5

Thread: Solved: Mail Merge layout setting

  1. #1

    Solved: Mail Merge layout setting

    Hi,

    I hope I'm using this forum correctly.
    My questions are: Am I able to set the mail merge layout of a document to Avery A4/A5 using code. And if so, does anyone know the code.
    I did this manually, recorded it as a macro, then stepped into the code hoping this particular statement would display. It didn't.
    The background to this is that I have an asp page that generates a mail merge document populated with data from sql server. The only problem is that it displays 10 rows per page. I'm after seven which is the Avery A4/A5 setting. By getting the code in word, I might be able to adapt it to the vb script in the asp page. Maybe not but that's what I was hoping.
    Any help would be greatly appreciated. Thank-you

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Hi and welcome to VBAX!

    Do you mean by: "Avery A4/A5 " the label format?

    Or do you change it by page setup?

    In other words can you describe how you set up the avery setting by hand? Usualy everything can be coded so if I know the steps I'll have a go at it.

    HTH,
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

  3. #3
    Hi MOS MASTER,

    Thanks for the reply and welcome.
    I actually found the solution.
    This is the course I followed when I did it manually and recorded by macro.
    I selected
    Tools - mail merge
    Create - Mailing labels
    I pressed the Active Document button
    I selected
    Get Data - Use Address book (irrelevant for my purposes)
    I selected my address book and pressed the Set up Main Document button

    The Label options dialog appears - this is the important bit. BY trail and error I found the the page layout that suited me is got by selecting
    Label Products - Avery A4 and A5 sizes
    Product Number - C2160-Sticker

    I wanted to see what the code was behind this last action so that I could adapt it to my asp page. I got my asp code from http://support.microsoft.com/?kbid=258512

    it had the following line of code

    oApp.MailingLabel.CreateNewDocument Name:="5160", Address:="", _
    AutoText:="MyLabelLayout", LaserTray:=wdPrinterManualFeed

    I replaced 5160 with C2160 and it worked. Seems very simple after the event.

    Thanks very much for the reply
    roc

  4. #4
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Hi Roc,

    Glad you found your sollution!

    Till the next encounter!
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

  5. #5
    VBAX Regular
    Joined
    Sep 2008
    Posts
    39
    Location
    glad for ya! another problem solved, i luv these forums!!

Posting Permissions

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