Results 1 to 5 of 5
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    Northampton, Northamptonshire, England
    Posts
    1,951
    Thanks
    2
    Thanked 1 Time in 1 Post

    Print Dialog arg: ? (Excel 2002/2003)

    Hi

    Sub PrintDialogShow()
    Application.Dialogs(xlDialogPrint).Show arg12:=2 (This arg sets Print What to Active Sheets) I also would like to set the arg for Print Range Page(s) as apposed to All but I can't work it out)

    End Sub

    Many Thanks

    Braddy
    If you are a fool at forty, you will always be a fool

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Print Dialog arg: ? (Excel 2002/2003)

    If you look up the help subject for Arguments for built-in dialogs in the VBA help, and scroll down to xlDialogPrint, you'll see that the first argument is 'range_num', the second one is 'from', and the third one is 'to'. Since you want the second option in the Print Range box, you must use 2 for the range_num argument. So to print pages 5 to 9:
    <code>
    Application.Dialogs(xlDialogPrint).Show Arg1:=2, Arg2:=5, Arg3:=9, Arg12:=2
    </code>
    You can find the names of the other arguments in the help subject I mentioned; you'll have to make a reasoned guess at their exact meaning.

  3. #3
    Silver Lounger
    Join Date
    Dec 2000
    Location
    Northampton, Northamptonshire, England
    Posts
    1,951
    Thanks
    2
    Thanked 1 Time in 1 Post

    Re: Print Dialog arg: ? (Excel 2002/2003)

    Hi Hans

    Thanks very much for your prompt reply and explanation.


    Braddy
    If you are a fool at forty, you will always be a fool

  4. #4
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Print Dialog arg: ? (Excel 2002/2003)

    Braddy,
    If you have the Macrofun.hlp file (you can download it from MS), you can look up the PRINT function - the arguments are the same as the dialog's I believe and the explanation of what they are is very good.
    HTH
    Regards,
    Rory

    Microsoft MVP - Excel

  5. #5
    Silver Lounger
    Join Date
    Dec 2000
    Location
    Northampton, Northamptonshire, England
    Posts
    1,951
    Thanks
    2
    Thanked 1 Time in 1 Post

    Re: Print Dialog arg: ? (Excel 2002/2003)

    Hi Rory

    Thanks for that, had a quick look, it does exactly what you describe,

    Braddy
    If you are a fool at forty, you will always be a fool

Posting Permissions

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