hannes08 Posted March 18, 2011 Posted March 18, 2011 Hi Folks, I had to write a script that updates an Excel sheet every day with a new sheet and a chart, so I went for a search in the Forum and found nothing that seemed to be suitable for me. So I went and wrote my own function that could do what I wanted it to. Right now I have only one function: _CreateExcelSheetWithChart() ; #FUNCTION# ==================================================================================================================== ; Name...........: _CreateExcelSheetWithChart ; Description ...: Creates an Excel File with a chart. ; Syntax.........: _CreateExcelWithChart($aData, $sFilename, $sSheetname, $iCharttype, [$iLabels = 0, [$sExtraaxis = 0, [$sHeadline = "", [$sXHeadline = "", [$sY1Headline = "", [$sY2Headline = ""]]]]]]) ; Parameters ....: $aData - A 2-dimenional array containing the data from [1][1] to [n1][n2]; the value for "n1" should be stored in [0][0]; the value for "n2" should be stored in [0][1] ; $sFilename - Path and name of the file that should be created. Existing files will be overwritten! ; $sSheetname - Name of the sheet that will be created. If the sheet already exists, the action will fail! ; $iCharttype - Type of chart that should be created; see global constants for a list ; $iLabels - Set to 1 to show labels next to datapoints ; $sExtraaxis - List of colum IDs that should be added to a secondary (extra) axis. Set to 0 for unconfigured. Example: "2|4" => columns 2 and 4 will be associated with secondary axis ; $sHeadline - Headline of the chart. Set to 0 fo unconfigured. ; $sXHeadline - Headline of the X-Axis of the chart. Set to 0 fo unconfigured. ; $sY1Headline - Headline of the Primary Y-Axis of the chart. Set to 0 fo unconfigured. ; $sY3Headline - Headline of the Secondary Y-Axis of the chart. Set to 0 fo unconfigured. ; Return values .: 1 - Success; 2 - Excel object could not be created (probably file is in use); 3 - Excel COM object could not be created ; Author ........: Hannes ; Related .......: Excel.au3 ; =============================================================================================================================== Func _CreateExcelSheetWithChart($a_data, $s_filename, $s_sheetname, $i_charttype, $labels = 0, $extraaxis = 0, $headline = "", $x_headline = "", $y1_headline = "", $y2_headline = "") Complete UDF(?) as attachment. It would be nice to get some feedback. Excel_Chart_UDF.au3 Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now