cheers guys,
im having the problem, that after running my code there are 2 excel workbooks opened up without anything in them.
im not even creating an(the code is being run from excel) excel app im just adding a workbook. then im adding some chart into it, change something and export it as an image. after that im closing the "activeworkbook".
this is my code:
Sub erstelleChart(gruenSelbst As String, rotFremd As String, location As String, filename As String) Dim diagrammPfad As String
Dim count As Integer
Dim objExcel As Object
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
diagrammPfad = "C:\Users\julian\Documents\Arbeit\Walter_Barwenczik\release\nurText\diagramm.xltx" '!
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Workbooks.Add (diagrammPfad)
For count = 2 To gruenSelbst 'Grüne Linie
ActiveChart.Shapes.Range(Array("Line 2")).Select
Selection.ShapeRange.IncrementLeft 82.5
Next count
For count = 2 To rotFremd 'Rote Linie
ActiveChart.Shapes.Range(Array("Line 1")).Select
Selection.ShapeRange.IncrementLeft 82.5
Next count
ActiveChart.Export filename:=location & "\" & filename, Filtername:="PNG"
ActiveWorkbook.Close
End Sub