Class CustomView (Excel VBA)

The class CustomView represents a custom workbook view. To use a CustomView class variable it first needs to be instantiated, for example


Dim cvw as CustomView
Set cvw = ActiveWorkbook.CustomViews(ViewName:=1)

For Each

Here is an example of processing the CustomView items in a collection.


With Worksheets(1) 
 .Cells(1,1).Value = "Name" 
 .Cells(1,2).Value = "Print Settings" 
 .Cells(1,3).Value = "RowColSettings" 
 rw = 0 
 For Each v In ActiveWorkbook.CustomViews 
 rw = rw + 1 
 .Cells(rw, 1).Value = v.Name 
 .Cells(rw, 2).Value = v.PrintSettings 
 .Cells(rw, 3).Value = v.RowColSettings 
 Next 
End With

Delete

Deletes the object.


ActiveWorkbook.CustomViews(1).Delete

Name

Returns a String value that represents the name of the object.


Dim strName As String
strName = ActiveWorkbook.CustomViews(1).Name

PrintSettings

True if print settings are included in the custom view.


Dim booPrintSettings As Boolean
booPrintSettings = ActiveWorkbook.CustomViews(1).PrintSettings

RowColSettings

True if the custom view includes settings for hidden rows and columns (including filter information).


Dim booRowColSettings As Boolean
booRowColSettings = ActiveWorkbook.CustomViews(1).RowColSettings

Show

Displays the object.


ActiveWorkbook.CustomViews(1).Show