April 2006
Beginner
1114 pages
98h 16m
English
customviews.Add(ViewName, [PrintSettings], [RowColSettings])
Creates a new view for the workbook.
|
Argument |
Settings |
|---|---|
|
|
The name of the view to create. |
|
|
True saves printer settings with the view; False omits them. Default is True. |
|
|
True saves hidden cell settings with the view; False omits them. Default is True. |
For example, the following code creates a new view that prints all worksheets in landscape orientation. The code also restores the original view:
Sub CreateLandscapeView( )
Dim ws As Worksheet, vw As CustomView, wb As Workbook
Set ws = ActiveSheet
Set wb = ThisWorkbook
' Save current settings.
wb.CustomViews.Add ("Default")
' Set worksheets to print landscape.
For Each ws In wb.Worksheets
ws.PageSetup.Orientation = xlLandscape
Next
' Save print settings as a view.
wb.CustomViews.Add "Landscape", True, False
' Restore the previous settings.
wb.CustomViews("Default").Show
End SubRead now
Unlock full access