About Using Named Views (VBA/ActiveX)

You can name and save a view you want to reuse. When you no longer need the view, you can delete it.

To create a new view, use the Add method to add a new view to the Views collection. When you save the drawing, the viewing position and scale of the view are saved.

You name the view when you create it. The name of the view can be up to 255 characters long and contain letters, digits, and the special characters dollar sign ($), hyphen (-), and underscore (_).

To delete a named view, simply use the Delete method. The Delete method for the View object lies on the View object, not its parent.

Add a View object

The following example adds a View object (viewObj).

Sub Ch3_AddView()
  ' Add a named view to the views collection
  Dim viewObj As AcadView
  Set viewObj = ThisDrawing.Views.Add("View1")
End Sub

Delete a View object

The following example deletes a View object (viewObj).

Sub Ch3_DeleteView()
  Dim viewObj As AcadView
  Set viewObj = ThisDrawing.Views("View1")
  ' Delete the view
  viewObj.Delete
End Sub

Delete a named view from the Views collection

This example deletes a named view from the Views collection.

Sub Ch3_DeleteViewFromCollection()
  ThisDrawing.Views("View1").Delete
End Sub