Sub Main 'Declare SurferApp as an object Dim SurferApp As Object Set SurferApp = CreateObject("Surfer.Application") SurferApp.Visible = True 'Specifies the upper and lower surfaces. The upper surface is a grid file, the lower 'surface can be another grid file or a constant Z value UpperSurface = SurferApp.Path+"\samples\demogrid.grd" LowerSurface = 0 'Calculates the volume and area. This method does not display the report window Dim Results() As Double SurferApp.GridVolume(upper:=UpperSurface,lower:=LowerSurface, presults:=Results, showreport:=False) 'Create a new worksheet window Set Wks = SurferApp.Documents.Add(srfDocWks) 'Put the contents of pResults (the Grid Volume report) in the worksheet cells Wks.Cells("A1") = "Upper Surface:" Wks.Cells("B1") = UpperSurface Wks.Cells("A2") = "Lower Surface:" Wks.Cells("B2") = LowerSurface Wks.Cells("A4").Value = "Trapezoidal Rule:" Wks.Cells("B4").Value = Results(srfGVTrapVol) Wks.Cells("A5").Value = "Simpson's Rule:" Wks.Cells("B5").Value = Results(srfGVSimpVol) Wks.Cells("A6").Value = "Simpson's 3/8 Rule:" Wks.Cells("B6").Value = Results(srfGVSimp38Vol) Wks.Cells("A7").Value = "Positive Volume [Cut]:" Wks.Cells("B7").Value = Results(srfGVPosVol) Wks.Cells("A8").Value = "Negative Volume [Fill]:" Wks.Cells("B8").Value = Results(srfGVNegVol) Wks.Cells("A10").Value = "Positive Planar Area:" Wks.Cells("B10").Value = Results(srfGVPosPlanarArea) Wks.Cells("A11").Value = "Negative Planar Area:" Wks.Cells("B11").Value = Results(srfGVNegPlanarArea) Wks.Cells("A12").Value = "Positive Area:" Wks.Cells("B12").Value = Results(srfGVPosArea) Wks.Cells("A13").Value = "Negative Area:" Wks.Cells("B13").Value = Results(srfGVNegArea) Wks.Cells("A14").Value = "Blanked Area:" Wks.Cells("B14").Value = Results(srfGVBlankedArea) 'Save worksheet Wks.SaveAs(SurferApp.Path+"\samples\VolumeReport.dat") End Sub