API Documentation > CorelDRAW > 2025-v26 > ActiveView > IVGActiveView
ActiveView.ToFitShapeRange method
Fits the active view to the given shape range
Syntax:
Sub ToFitShapeRange(ByVal ShapeRange As ShapeRange)
Parameters:
Name Type Description
ShapeRange
Remarks:
The ToFitShapeRange method changes the active view to fit an entire collection of shape objects on the current page into the application window. The ToFitShapeRange method adjusts the zoom level of the page so that the specified shapes fill the current view in the application window.
Examples:
The following VBA example creates a rectangle and circle on the current page, adds the rectangle and the circle to a shape range, and uses the ToFitShapeRange method to adjust the active view and zoom in so that the shapes in the shape range make up the entire view in CorelDRAW.
Sub ToFitShapeRange()
Dim s As Shape
Dim sr As New ShapeRange
Set s = ActiveLayer.CreateEllipse2(5, 5, 2)
sr.Add s 'Creates an ellipse and includes it in the defined range
Set s = ActiveLayer.CreateRectangle(0, 0, 2, 2)
sr.Add s 'Creates a rectangle and includes it in the defined range
ActiveWindow.ActiveView.ToFitShapeRange sr 
End Sub