Sub Main
    Dim SurferApp, Plot, MapFrame1, ContourLayer, MapFrame2, PostLayer As Object
    Set SurferApp = CreateObject("Surfer.Application")
    SurferApp.Visible = True

    'Set path
    Path=SurferApp.Path+"\Samples\"

    Set Plot = SurferApp.Documents.Add

    'Creates a contour map
    Set MapFrame1 = Plot.Shapes.AddContourMap(GridFileName:=Path+"demogrid.grd")
    Set ContourLayer = MapFrame1.Overlays(1)

    'Name the contour layer
    ContourLayer.Name = "This is My Contour Layer"

    'Creates a post map
    Set MapFrame2 = Plot.Shapes.AddPostMap(DataFileName:=Path+"demogrid.dat")
    Set PostLayer = MapFrame2.Overlays(1)

    'Name the post layer
    PostLayer.Name = "This is My Post Layer"

    'Select and overlays the map objects
    MapFrame1.Selected = True
    MapFrame2.Selected = True
    Set NewMapFrame = Plot.Selection.OverlayMaps

    'Name the map frame
    NewMapFrame.Name = "Demogrid Map"

End Sub
