Workbook.PrintOut

Use this function to print either the current item in the workbook or the entire workbook.

Syntax Parameters Return value
Sub Workbook.PrintOut( _
    Optional PrintOnlySelected As Boolean = False, _
    Optional ShowPrintDialog As Boolean = False)
  • PrintOnlySelected [in, optional]

    Whether to print only the highlighted item in the workbook, or to print every item. This parameter defaults to False.

    Type: Boolean

    Default value: False

  • ShowPrintDialog [in, optional]

    Whether to display the print dialog before printing, or to simply use the default printer and print settings. This parameter defaults to False.

    Type: Boolean

    Default value: False

This function does not return a value.

SVB Example

Printing an item from a workbook

Option Base 1
Option Explicit
Sub Main
    Dim wb As Workbook
    'assigns the new workbook to the object wb
    Set wb = Workbooks.New("WB Example")
    'inserts the file adstudy.sta into the root folder
    'of the workbook as the first child
    wb.InsertFile(Path & _
        "\examples\datasets\adstudy.sta",wb.Root,scWorkbookFirstChild)
    'sets the workbook to visible
    wb.Visible = True
    'prints the current item in the workbook
    'print only selected and doesn't show the print dialog
    wb.PrintOut(True,False)
End Sub