本帖最后由 wanghao4023030 于 2012-11-6 17:22 编辑
问题找到了 charttype有问题,造成的 最新代码如下:#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.8.1
Author: myName
Script Function:
Template AutoIt script.
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
; ***************************************************************
; Example 1 - Open an existing workbook and returns its object identifier.
; *****************************************************************
#include <Excel.au3>
#include <File.au3>
#include <ExcelChart.au3>
Dim $sFilePath1,$oExcel
;~ Local $sFilePath1 = @ScriptDir & "\Test.xls" ;This file should already exist
$sFilePath1 = "C:\wanghao.csv" ;This file should already exist
$oExcel = _ExcelBookOpen($sFilePath1)
;~ $oExcel = ObjGet("","Excel.Application")
$oExcel.Worksheets("wanghao").Activate
$oExcel.Columns("A:B").Select
$oExcel.Charts.Add
$oExcel.ActiveChart.ChartType = "63"
$oExcel.ActiveChart.SetSourceData($oExcel.Sheets("wanghao").Range("A:A,B:B"),"xlColumns")
$oExcel.ActiveChart.Location(2,"123")
$oExcel.ActiveChart.HasTitle = True
$oExcel.ActiveChart.ChartTitle.Characters.Text = "ProcessTime %"
;~ $oExcel.ActiveChart.Axes("xlCategory", "xlPrimary").HasTitle = False
;~ $oExcel.ActiveChart.Axes("xlCategory", "xlPrimary").HasTitle = False
;~ $oExcel.ActiveChart.Axes("xlValue", "xlPrimary").HasTitle = False
_ExcelBookSave($oExcel,-1)
;~ _ExcelSheetAddNew($oExcel,"123")
_ExcelBookClose($oExcel)
用字符代替了charttype的英文表示,就他娘的对了,fuck~~~
$oExcel.ActiveChart.ChartType = "63" |