Sub Main Dim SurferApp As Object Set SurferApp = CreateObject("Surfer.Application") SurferApp.Visible = True 'This starts a loop to grid, contour, and print out 5 separate data files 'that have consecutive names such as datafile1.dat, datafile2.dat, etc. For i = 1 To 3 'Opens a new plot document Dim Plot As Object Set Plot = SurferApp.Documents.Add 'Specifies the path to the data file Path = "c:\temp\SAMPLE"+Format(i) 'Create a grid from teh data file SurferApp.GridData(DataFile:=Path+".DAT", OutGrid:=Path+".grd") 'Creates a contour map from the grid file Dim Map As Object Set Map = Plot.Shapes.AddContourMap(GridFileName:=Path+".grd") 'Prints the plot document Plot.PrintOut Next i End Sub