Sub Main 'Initialize Grapher Dim GrapherApp As Object Set GrapherApp = CreateObject("Grapher.Application") GrapherApp.Visible = True Set Plot1 = GrapherApp.Documents.Add(grfPlotDoc) 'Create a line plot Set Graph1 = Plot1.Shapes.AddLinePlotGraph(GrapherApp.Path + "\samples\tutorial.dat") 'Add additional line plots Graph1.AddLinePlot(GrapherApp.Path + "\samples\tutorial.dat",,3) Graph1.AddLinePlot(GrapherApp.Path + "\samples\tutorial.dat",,4) Graph1.AddLinePlot(GrapherApp.Path + "\samples\tutorial.dat",,5) Graph1.AddLinePlot(GrapherApp.Path + "\samples\tutorial.dat",,6) Graph1.AddLinePlot(GrapherApp.Path + "\samples\tutorial.dat",,7) Graph1.AddLinePlot(GrapherApp.Path + "\samples\tutorial.dat",,8) Graph1.AddLinePlot(GrapherApp.Path + "\samples\tutorial.dat",,9) 'Change the colors of each line Graph1.Plots.Item(1).line.foreColor = grfColorBlue Graph1.Plots.Item(2).line.foreColor = grfColorGreen Graph1.Plots.Item(3).line.foreColor = grfColorRed Graph1.Plots.Item(4).line.foreColor = grfColorMagenta Graph1.Plots.Item(5).line.foreColor = grfColorPurple Graph1.Plots.Item(6).line.foreColor = grfColorOrange Graph1.Plots.Item(7).line.foreColor = grfColorPastelBlue Graph1.Plots.Item(8).line.foreColor = grfColorOceanGreen 'Add legend Set Legend = Graph1.AddLegend(True) 'Link each entry to specific worksheet cell Legend.EntryName(1,"<<@b1>>") Legend.EntryName(2,"<<@c1>>") Legend.EntryName(3,"<<@d1>>") Legend.EntryName(4,"<<@e1>>") Legend.EntryName(5,"<<@f1>>") Legend.EntryName(6,"<<@g1>>") Legend.EntryName(7,"<<@h1>>") Legend.EntryName(8,"<<@i1>>") 'Link legend entries to worksheet i=1 While i < Legend.EntryCount+1 Legend.EntryFont(i).worksheet = GrapherApp.Path+"\Samples\Tutorial.dat" i=i+1 Wend 'Change entry font for all lines i=1 While i <= Legend.EntryCount Legend.EntryFont(i).face = "Times New Roman" Legend.EntryFont(i).Bold = True Legend.EntryFont(i).color = grfColorGreen Legend.EntryFont(i).Italic = True Legend.EntryFont(i).size = 8 i=i+1 Wend End Sub