Sub Main Debug.Clear ''''''''''''' User Variables '''''''''''''''''' 'You must enter the path to the grid files and the name of the BLN file file_directory = "C:\temp\GRIDS\" BLN_file = file_directory+"DemoRect.bln" ''''''''''''''''''''''''''''''''''''''''''''''' file_extension = "grd" Set surf = CreateObject("surfer.application") surf.Visible = True 'Progress for each file can be seen in the status bar of the application. 'Make sure the file extension has no extra . and the data directory has a trailing \ file_extension = LCase(Right(file_extension,(Len(file_extension) - InStrRev(file_extension,".")))) If Len(file_directory)-InStrRev(file_directory,"\") <> 0 Then file_directory = file_directory + "\" grid_file = Dir( file_directory + "*." + file_extension) On Error GoTo FileError While grid_file <> "" 'Define output grid file directory & name blanked_file = file_directory + Left(grid_file, Len(grid_file)-(Len(grid_file)-InStrRev(grid_file,".")+1) ) + "_blanked.grd" 'Grid the data file with the current Surfer defaults (but do not fill the screen with grid reports) surf.GridBlank(file_directory + grid_file, BLN_file, blanked_file) Debug.Print grid_file grid_file = Dir() 'get next file Wend surf.Quit Exit Sub 'Print a meaningful error message for each file that did not grid correctly FileError: Debug.Print "Error: " + blanked_file + " " + Err.Description Resume Next End Sub ' Helpful error hints: ' 'a) If the script appears to do nothing, make sure file_directory is valid. 'b) "xMin must be < xMax" usually means there is no griddable data. Check if there really is data, if it is in columns ABC, and that it is formatted as number and not as text or general. 'c) "Insufficient data in worksheet" means there are less than three griddable Z values in the worksheet. 'd) "Inadequate data (all data lie in a horizontal plane)" means that all Z values are the same. 'e) "Unknown worksheet import format" the file format was incompatible with Surfer. Common if the file was an Excel 2007 spreadsheet and your Surfer version is 8 or lower.