Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Mar 2005
    Location
    Leicestershire, United Kingdom
    Posts
    506
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Pages to Print and Copies from VBA

    Hi,

    I have some vba code that creates a mailmerge:

    Set objWord = New Word.Application
    'Letter document would be open
    Set objletter = objWord.Documents.Open(strletterpath & strworddoc)
    objletter.MailMerge.OpenDataSource (strletterpath & strletterfile)
    objletter.MailMerge.Destination = wdSendToPrinter 'normally print
    objletter.MailMerge.Execute

    What I want to be able to do is specify the page numbers to be printed, but if possible how many copies of the doucment I need from vba.
    Best Regards,

    Luke

  2. #2
    New Lounger
    Join Date
    Dec 2009
    Location
    Sherwood, OR, USA
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Record a macro of setting your values and printing, then look at the macro.

    You should see something like this:
    Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _
    wdPrintDocumentWithMarkup, Copies:=2, Pages:="1,3", PageType:= _
    wdPrintAllPages, Collate:=True, Background:=False, PrintToFile:=False, _
    PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
    PrintZoomPaperHeight:=0

    Modify it to something like this (I don't think you need to set all the default values):
    objletter.PrintOut Copies:=2, Pages:="1,3"

    Add it above your line, objletter.MailMerge.Execute
    Jack

  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    Quote Originally Posted by JackStockton View Post
    Record a macro of setting your values and printing, then look at the macro.

    Add it above your line, objletter.MailMerge.Execute
    Surely it needs to be After the MailMerge.Execute.
    Regards
    John



Posting Permissions

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