Inspired by Learning one's BarChart... Excel Charts creates a graph in Excel, saves the graph as an image and displays it in a GUI.
**EDIT: originally was a question.. solved below ... working examples from post #2 onwards!**
-tested on AHK_L & Excel 2010 (3D graphs may not work in prior versions)
Original question:
How could I save the graph as an image WITHOUT making Excel visible through the whole process. I don't want the user to see Excel open at all. I want them to be able to run the script, and then a GUI with their graph will show up.
XL := ComObjCreate("Excel.Application") XL.WorkBooks.Add XL.Visible := true ;<--- I want this to be false... so Excel never appears XL.Range("A1").Value := "Sept" XL.Range("A2").Value := "Oct" XL.Range("A3").Value := "Nov" XL.Range("A4").Value := "Dec" XL.Range("B1").Value := 10 XL.Range("B2").Value := 14 XL.Range("B3").Value := 33 XL.Range("B4").Value := 21 XL.Range("A1:B4").Select XL.ActiveSheet.Shapes.AddChart.Select XL.ActiveChart.ChartType := 63 XL.ActiveChart.PlotArea.Select XL.ActiveChart.SetElement(207) XL.Range("A1").Select return
Here's the result of running the above script...
I want to save the graph as an image and show it in a GUI... so the user only sees this