Sub Main

'Declare the variable that will reference the application
	Dim SurferApp As Object
	Set SurferApp = CreateObject("Surfer.Application")
	SurferApp.Visible = True

'Declares Plot as an object
	Dim Plot As Object
	Set Plot = SurferApp.Documents.Add

'Declares MapFrame as Object
	Dim MapFrame1 As Object

'Creates surface map and assigns the map frame to the variable "MapFrame1"
	Set MapFrame1 = Plot.Shapes.AddSurface(GridFileName:=SurferApp.Path+"\samples\demogrid.grd")

'Creates a contour map and assigns the map frame to the variable "MapFrame2"
	Set MapFrame2 = Plot.Shapes.AddContourMap(GridFileName:=SurferApp.Path+"\samples\demogrid.grd")
	Dim ContourLayer As Object
	Set ContourLayer = MapFrame2.Overlays(1)

'Creates a post map and assigns the map frame to the variable "MapFrame3"
	Set MapFrame3 = Plot.Shapes.AddPostMap (SurferApp.Path+"\samples\demogrid.dat")
	Dim PostLayer As Object
	Set PostLayer = MapFrame3.Overlays(1)

'Selects the three maps
	MapFrame1.Selected = True
	MapFrame2.Selected = True
	MapFrame3.Selected = True

'Overlays the maps and set the overlay to NewMapFrame
	Set NewMapFrame = Plot.Selection.OverlayMaps

'Breaks apart the overlay and sets the new map frame to NewMapFrame2
'For more overlay options, see Overlays Collection
	Set NewMapFrame2 = NewMapFrame.Overlays.BreakApart(pOverlay:=ContourLayer)

End Sub
