Name

customview.Show

Synopsis

Makes a view active. This may or may not change the display. For example, the following code switches to the Landscape view created earlier, prints the workbook, then restores the default view. Because the Landscape view includes only print settings, the appearance of the worksheets does not change.

Sub PrintLandscape(  )
    Dim wb As Workbook
    Set wb = ThisWorkbook
    ' Set landscape view.
    wb.CustomViews("Landscape").Show
    wb.PrintOut , , , True
End Sub

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.