Consulting

Results 1 to 2 of 2

Thread: Sleeper: Error in built-in dialog xlDialogPrinterSetup

  1. #1
    VBAX Newbie
    Joined
    Mar 2005
    Posts
    1
    Location

    Question Sleeper: Error in built-in dialog xlDialogPrinterSetup

    I use Application.Dialogs(xlDialogPrinterSetup).Show for selecting a printer on a custom print userform in Excel. It works great for selecting the printer, but the "Setup..." button on the dialog does not access the right printer until after you hit OK, then access the dialog again, and hit "Setup..." a second time.

    Say you have two printers, P1, P2, and P1 is the default printer. You press the "Select Printer" button which calls Application.Dialogs(xlDialogPrinterSetup).Show. Then select P2, and press "Setup..." (to change printer properties). This gives properties for P1, rather than P2, even though P2 is highlighted. Apparently the dialog doesn't pass along the highlighted printer to the properties query, but rather passes the active printer.

    Is there any way around this so you don't have to access the dialog twice in order to change printer properties? Here is the code I use...

    Private Sub CommandButton4_Click() 
    'print setup (select printer) 
    Application.Dialogs(xlDialogPrinterSetup).Show 
    End Sub

  2. #2
    VBAX Master TonyJollans's Avatar
    Joined
    May 2004
    Location
    Norfolk, England
    Posts
    2,291
    Location
    Hi ptlarson,

    Welcome to VBAX!

    I'd be very interested to know if there's a fix for this, but I suspect not. I've done a fair bit with built-in Dialogs (more in Word than Excel) and they are extremely difficult to work with, poorly documented, and not at all consistent. I have found that trial and error on an individual dialog basis is the only way to go. What you see is what you get! And what you describe does seem to be the case here.
    Enjoy,
    Tony

    ---------------------------------------------------------------
    Give a man a fish and he'll eat for a day.
    Teach him how to fish and he'll sit in a boat and drink beer all day.

    I'm (slowly) building my own site: www.WordArticles.com

Posting Permissions

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