Hallo,
habe von bugfix ein beispiel bekommen wie man eine diagram unter excel erstellt...
leider weiss ich nicht wie ich das an eine vorhandene excel tabelle einfügen kann.
Die vorhandene excel tabelle erzeuge ich auch unter autoit.
zum schluss will ich dann eine diagramm erzeugen und in die vorhandene exeltabelle das diagramm plazieren.
hier mein code:
Spoiler anzeigen
#include <File.au3>
#include <Excel.au3>
Global $oExcel = __ExcelBookNew(1)
Global $currUHD_UT = 1, $currUHD_BE = 1, $currUHD_Host = 1, $curr_On = 1, $curr_ITSPS = 1, $curr_cust = 1, $curr_xml = 1
_ExcelSheetNameSet($oExcel, "Gesamt");ok
_ExcelSheetAddNew($oExcel, "xxx");ok
_ExcelSheetAddNew($oExcel, "yyy");ok
_ExcelSheetAddNew($oExcel, "vvv");ok
_ExcelSheetAddNew($oExcel, "qqq");ok
Local $sNamen = 'user,user2,user3,user4'
Local $sHeader = 'xxx,yyy,vvv,qqq,Summe'
Local $aNamen = StringSplit($sNamen, ','), $aHeader = StringSplit($sHeader, ',')
_ExcelSheetActivate($oExcel, "Gesamt")
For $i = 1 To UBound($aHeader) -1
_ExcelWriteCell($oExcel, $aHeader[$i], 1, $i+1)
Next
For $i = 1 To UBound($aNamen) -1
_ExcelWriteCell($oExcel, $aNamen[$i], $i+1, 1)
Next
With $oExcel.ActiveWorkbook.Sheets(5)
For $i = 2 To 6
.Range("B" & $i).Formula = "=ZÄHLENWENN('xxx'!D:D;A" & $i & ")"
.Range("C" & $i).Formula = "=ZÄHLENWENN('yyy'!D:D;A" & $i & ")"
.Range("D" & $i).Formula = "=ZÄHLENWENN('vvv'!D:D;A" & $i & ")"
.Range("E" & $i).Formula = "=ZÄHLENWENN('qqq'!D:D;A" & $i & ")"
.Range("F" & $i).Formula = "=SUMME(B" & $i & ":E" & $i & ")"
Next
For $i = 66 To 69
.Range(Chr($i) & "6").Formula = "=SUMME(" & Chr($i) & "2:" & Chr($i) & "5)"
Next
.Range("A6") .Value = "SUMME"
.Range("b1:f1").Font.Bold = TRUE
.Range("a6:f6").Font.Bold = TRUE
.Range("b1:e1").Interior.Color = 0xCCFFCC
.Range("A2:e6").Interior.Color = 0xCCFFFF
.Range("A3") .Interior.Color = 0xFFFF99
.Range("A5") .Interior.Color = 0xFFFF99
.Range("b2:f5").Interior.Color = 0xCCFFFF
.Range("b3:f3").Interior.Color = 0xFFFF99
.Range("b5:f5").Interior.Color = 0xFFFF99
.Range("b6:f6").Interior.Color = 0xCC99FF
.Range("A1:A6").ColumnWidth = 20.00 ; Spaltenbreite festlegen
.Range("B1:E6").ColumnWidth = 24.00 ; Spaltenbreite festlegen
.Range("B1:E1").HorizontalAlignment = $xlCenter
EndWith
Local $Folder = 'remedy\'
Local $File = 'export.csv'
$var = FileOpenDialog("", @ScriptDir & "\", "Remedy (*.csv)", 1 + 4 )
Local $Array
_FileReadToArray($var, $Array)
Global $aSplit
Global $TicketID, $CreateDate, $Submitter, $AssignInd, $AssignGrp, $Descript
For $i = 1 To UBound($Array) -1
$aSplit = StringSplit($Array[$i], ',')
If $i = 1 Then
$SheetList = _ExcelSheetList($oExcel)
For $j = 1 To UBound($aSplit) -1
For $k = 1 To $SheetList[0] -1
_ExcelSheetActivate($oExcel, $SheetList[$k])
_ExcelWriteCell($oExcel, StringReplace($aSplit[$j], '"', ''), 1, $j)
Next
Next
ContinueLoop
EndIf
$TicketID = $aSplit[1]
$CreateDate = $aSplit[2]
$Submitter = $aSplit[3]
$AssignInd = $aSplit[4]
$AssignGrp = $aSplit[5]
$Descript = $aSplit[6]
Select
Case StringInStr($Descript, 'xxxx'); sucht in Short Description nach auftrag und gibt es in TopCon Admin HH wieder
$curr_ITSPS += 1
_AddToGroup('ffff', $curr_ITSPS)
;$curr_Admin += 1
Case StringInStr($Submitter, 'Interface_XMLImport'); sucht in Short Description nach auftrag und gibt es in TopCon Admin HH wieder
$curr_xml += 1
_AddToGroup('ffff', $curr_xml)
;$curr_Admin += 1
Case StringInStr ($AssignGrp, 'ffff')
;~ $curr_MAC += 1 ; <==== Das war der Fehler!!
$curr_On += 1
_AddToGroup('jjjjjjj', $curr_On)
Case StringInStr ($AssignGrp, 'kkkkkkkkk')
;~ $curr_MAC += 1 ; <==== Das war der Fehler!!
$curr_cust += 1
_AddToGroup('jjjjjjjj', $curr_cust)
EndSelect
Next
_ExcelSheetActivate($oExcel, "Gesamt")
$oExcel.Visible = 1
Func _AddToGroup($Group, $currRow)
_ExcelSheetActivate($oExcel, $Group)
For $i = 1 To UBound($aSplit) -1
_ExcelWriteCell($oExcel, StringTrimLeft(StringTrimRight($aSplit[$i], 0), 0), $currRow, $i)
Next
EndFunc
Func __ExcelBookNew($fVisible = 1, $iSheetsStartup = 1)
Local $oExcel = ObjCreate("Excel.Application")
If Not IsObj($oExcel) Then Return SetError(1, 0, 0)
If Not IsNumber($fVisible) Then Return SetError(2, 0, 0)
If $fVisible > 1 Then $fVisible = 1
If $fVisible < 0 Then $fVisible = 0
If $iSheetsStartup < 1 Then $iSheetsStartup = 1
With $oExcel
.SheetsInNewWorkbook = $iSheetsStartup
.Visible = $fVisible
.WorkBooks.Add
.ActiveWorkbook.Sheets(1).Select ()
EndWith
Return $oExcel
EndFunc
im anhang das beispiel von bugfix....