Consulting

Results 1 to 7 of 7

Thread: Can vba do the printer setting?

  1. #1
    VBAX Contributor
    Joined
    Nov 2009
    Posts
    114
    Location

    Can vba do the printer setting?

    By using vba excel

    I want to print on

    1. both sized
    2. short edge left
    3. paper from drawer no 2


    If vba cannot do that , what kind of programming can do that?

  2. #2
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    VBA can change advanced printer settings using calls to the Windows API - here is a sample in the Microsoft Knowledge Base. Basic settings like margins can be done using the PageSetup object.
    Be as you wish to seem

  3. #3
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    My method is to create a "clone" of the printer and set its defaults to the output you are after. I found some code to switch printers and put it together here
    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
    VBAX Contributor
    Joined
    Nov 2009
    Posts
    114
    Location
    Where is set the printername or Dervice name?

    My dervice name is "Canon MP170 Series Printer ->>IP_192.168.0.1_9100(usb_port1)"

    And i don't know where to set the paper source and short edge left ?
    Attached Files Attached Files

  5. #5
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Using my solution, these would be set in the printer settings accessed through control panel.
    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'

  6. #6
    VBAX Contributor
    Joined
    Nov 2009
    Posts
    114
    Location
    But where can set the following variable

    1. both sized
    2. short edge left
    3. paper source

  7. #7
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Check the printer manual and help files.
    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
  •