'Uses the existing open window
'Saves to existing format and exports to PDF and PNG

Sub Main
	'Create Grapher as an Object
	Dim Grapher As Object

	'Start Grapher
	Set Grapher = CreateObject("Grapher.Application")

	'Make Grapher visible
	Grapher.Visible = True

	'Get the current plot window
	Set Plot1 = Grapher.Documents.Active

	'Save file to existing name
	Plot1.Save

	'Exports file to PDF with same name and location as plot - uses defaults
	Plot1.Export2(Left(Plot1.FullName,Len(Plot1.FullName)-3) + "pdf",False,"Defaults=0",True,"pdfv")

	'Exports file to PNG with same name and location as plot - uses defaults
	Plot1.Export2(Left(Plot1.FullName,Len(Plot1.FullName)-3) + "png",False,"Defaults=0", True, "png")

End Sub
