+ Reply to Thread
Results 1 to 4 of 4

WinAPI Printer Setting Issue

  1. #1
    Forum Contributor
    Join Date
    01-25-2011
    Location
    Virginia
    MS-Off Ver
    Excel 2016
    Posts
    166

    WinAPI Printer Setting Issue

    I am modifying the code from MSDN KB Article ID: 230743 "HOWTO: Set Duplex Printing for Word Automation" to set ALL printer settings The code works fine but for printer settings that can be set via an Excel command (like orientation - ActiveSheet.PageSetup.Orientation=xlPortrait), the setting changes in Windows control panel – Devices and Printers but NOT in the Excel Print window. Also, if I exit Excel and restart it then the new printer setting shows. I have tried changing printers back and forth as was recommended elsewhere in this forum, but that does not work. I also tried the WinAPI function SendMessageTimeout
    Please Login or Register  to view this content.
    But that did not work either?

    So after this long explanation my question is Is there a way to tell Excel that the printer setting has changed or do I just have to use the XL commands for printer settings that Excel supports?

    Thanks in advance,

    Tom

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: WinAPI Printer Setting Issue

    Hello Tom,

    Windows applications generally reset printer settings to saved values. This is one of the headaches when using API calls. You can change the settings but the application will reset them as soon as you choose to print from within the application. Another problem is not all printers respond to having the duplex flag by changed by the Windows API and will only make the change via the print driver.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: WinAPI Printer Setting Issue

    Hello Tom,

    Windows applications generally reset printer settings to saved values. This is one of the headaches when using API calls. You can change the settings but the application will reset them as soon as you choose to print from within the application. Another problem is not all printers respond to having the duplex flag by changed by the Windows API and will only make the change via the print driver.

  4. #4
    Forum Contributor
    Join Date
    01-25-2011
    Location
    Virginia
    MS-Off Ver
    Excel 2016
    Posts
    166

    Re: WinAPI Printer Setting Issue

    Letih,
    Thanks, I figured you would be the one to know. MSFT should really build a better VBA interface with the printer!

    Regards,

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1