Sub Main 'Initialize Grapher Dim GrapherApp, Docs, Plot, Graph1 As Object Set GrapherApp = CreateObject("Grapher.Application") GrapherApp.Visible = True Set Docs = GrapherApp.Documents Set Plot = Docs.Add(grfPlotDoc) 'Create a line plot Set Graph1 = Plot.Shapes.AddLinePlotGraph(GrapherApp.Path + "\samples\tutorial.dat") Set Line1 = Graph1.Plots(1) Set XAxis = Graph1.Axes("X Axis 1") 'Add second line plot Set Line2 = Graph1.AddLinePlot(GrapherApp.Path + "\samples\tutorial.dat",1,3) 'Change Line color for Line2 Line2.line.foreColor = grfColorBlue 'Set the XAxis to use date/time labels XAxis.TickLabels.UseDateTimeFormat = True 'Change the Date/time format XAxis.TickLabels.MajorFormat.DateTimeFormat = 0 'Add a legend Set Legend1 = Graph1.AddLegend(True) 'Change the text of the legend line text to show the column name Legend1.EntryName(1,"<<@b1>>") Legend1.EntryName(2,"<<@c1>>") 'Link legend entries to worksheet Wks = GrapherApp.Path+"\Samples\Tutorial.dat" i=1 While i < Legend1.EntryCount+1 Legend1.EntryFont(i).worksheet = wks i=i+1 Wend 'Export to a TIF that contains the same name as the data file name Plot.Export(Left(Wks,Len(Wks)-3)+"TIF") End Sub