none
Set properties at run time of Excel Chose Printer dialog box RRS feed

  • Question

  • I use the following code to display to the user a dialog box that

    allows him to choose a printer to print an Excel spreadsheet. The

    code occurs in a VB.net Windows Form app. Can someone tell me how

    I can set the properties of the Choose Printer dialog at run time

    to, for example, set the position of the dialog box on the user's

    screen?

    Code:

    Dim xlDialogPrinterSetup As New Excel.XlPrintLocation 

    objapp.Dialogs(Excel.XlBuiltInDialog.xlDialogPrinterSetup).Show()

    Thanks for any and all help

    jcirish

    Tuesday, April 21, 2015 3:50 PM

Answers

  • Re:  xlDialogPrinterSetup

    FWIW...
    In VBA the only optional argument for this dialog is "printer_text".
    So you can specify the printer name you want displayed to the user, such as...
      Application.Dialogs(xlDialogPrinterSetup).Show(ActivePrinter)
    -or-
      Application.Dialogs(xlDialogPrinterSetup).Show(Arg1:=ActivePrinter)

    In Excel,  the PrinterSetup dialog box remembers its closing location and is displayed in that location the next time it is opened.

    Also...
    "Built-In Dialog Box Arguments Lists"...
       https://msdn.microsoft.com/en-us/library/office/ff838781%28v=office.14%29.aspx

    '---

    Jim Cone
    Portland, Oregon USA
    https://goo.gl/IUQUN2 (Dropbox)
    (free & commercial excel add-ins & workbooks)

    Tuesday, April 21, 2015 5:21 PM
  • Hi, Jim. Thanks for the response. My code allows the user to choose from available printers. The news that the PrintSetup Dialog box remembers its last position may be quite helpful to me, as well as the links provided. I think this is helpful and I'll mark it as an answer.
    • Marked as answer by jcirish Tuesday, April 21, 2015 7:04 PM
    Tuesday, April 21, 2015 7:04 PM

All replies

  • Re:  xlDialogPrinterSetup

    FWIW...
    In VBA the only optional argument for this dialog is "printer_text".
    So you can specify the printer name you want displayed to the user, such as...
      Application.Dialogs(xlDialogPrinterSetup).Show(ActivePrinter)
    -or-
      Application.Dialogs(xlDialogPrinterSetup).Show(Arg1:=ActivePrinter)

    In Excel,  the PrinterSetup dialog box remembers its closing location and is displayed in that location the next time it is opened.

    Also...
    "Built-In Dialog Box Arguments Lists"...
       https://msdn.microsoft.com/en-us/library/office/ff838781%28v=office.14%29.aspx

    '---

    Jim Cone
    Portland, Oregon USA
    https://goo.gl/IUQUN2 (Dropbox)
    (free & commercial excel add-ins & workbooks)

    Tuesday, April 21, 2015 5:21 PM
  • Hi, Jim. Thanks for the response. My code allows the user to choose from available printers. The news that the PrintSetup Dialog box remembers its last position may be quite helpful to me, as well as the links provided. I think this is helpful and I'll mark it as an answer.
    • Marked as answer by jcirish Tuesday, April 21, 2015 7:04 PM
    Tuesday, April 21, 2015 7:04 PM