Module
GlobalModul
....
Public
oXL
As
Excel.Application =
New
Excel.Application
Public
oWB
As
Excel.Workbook
Public
oSheet
As
Excel.Worksheet
Public
oRng
As
Excel.Range
....
End
Module
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Private
Sub
chart(
ByVal
rows
As
Integer
,
ByVal
column
As
String
,
ByVal
name
As
String
)
Dim
co
As
Excel.Chart
oRng = oSheet.Range(column +
"3"
&
":"
& column + (rows + 3).ToString &
",F3:F"
& rows + 3 &
",I3:I"
& rows + 3)
co = oWB.Charts.Add
With
co
.ChartType = Excel.XlChartType.xlColumnClustered
.SetSourceData(Source:=oRng, PlotBy:=Excel.XlRowCol.xlColumns)
.HasTitle =
True
.ChartTitle.Text = name &
": Umsatz - Ertrag"
.SeriesCollection(1).Name =
"="
"Umsatz"
""
.SeriesCollection(2).Name =
"="
"Ertrag"
""
.Location(Where:=Excel.XlChartLocation.xlLocationAsObject, Name:=name)
.HasLegend =
True
.Legend.Position = Excel.XlLegendPosition.xlLegendPositionBottom
End
With
End
Sub