'Zoom Rectangle.bas utilizes ZoomRectangle to zoom into the corners of a map layer. '===================================== Sub Main 'Declare the variable that will reference the application Set SurferApp = CreateObject("Surfer.Application") Dim Doc As Object SurferApp.Visible = True 'Declares Plot as an object Dim Plot As Object Set Plot = SurferApp.Documents.Add(srfDocPlot) 'Assigns the new plot window to the variable named "PlotWindow" Dim PlotWindow As Object Set PlotWindow = Plot.NewWindow 'Creates a contour map from Demogrid.grd Set MapFrame = Plot.Shapes.AddContourMap(GridFileName:=SurferApp.Path+"\Samples\Demogrid.grd") 'Sets the Contours map layer to "Contours" Set Contours = MapFrame.Overlays(1) 'Sets the corners of the Contours map layer TopCorner = Contours.Top LeftCorner = Contours.Left BottomCorner = Contours.Top - Contours.Height RightCorner = Contours.Left + Contours.Width 'Zooms to the small map PlotWindow.ZoomRectangle(Left:=LeftCorner, Top:=TopCorner, Right:=RightCorner, Bottom:=BottomCorner) End Sub