By Adam Nagy
Though the sketch object itself has no RangeBox that could be used to tell its extents, you can iterate through its entities and combine their extents into a single Box2d object that will provide that information:
Sub GetSketchExtents()' Select the sketch in the UI before running the code Dim oSketch As PlanarSketch Set oSketch = ThisApplication.ActiveDocument.SelectSet(1) Dim oRB As Box2d Set oRB = ThisApplication.TransientGeometry.CreateBox2d Dim oEnt As SketchEntity For Each oEnt In oSketch.SketchEntities Call oRB.Extend(oEnt.RangeBox.MinPoint) Call oRB.Extend(oEnt.RangeBox.MaxPoint) Next Call MsgBox( _"(Value in internal length unit (cm))" + vbCrLf + _"Min = " + _ str(oRB.MinPoint.x) + _ str(oRB.MinPoint.y) + vbCrLf + _"Max = " + _ str(oRB.MaxPoint.x) + _ str(oRB.MaxPoint.y)) End Sub