klaushaas
12-18-2015, 03:03 AM
Hi,
I've just made it to create a chart in a userform by creating the chart in the background (in the table) and exporting it as a jpeg-file saved locally. this is actually the only solution i've found in the internet so far.
is it possible to do this without creating a new jpeg file on the hard drive ? so i just wanna create a chart in the table and have it shown as an image in my userform.. or like saving the image temporarily in a table if possible. here is an extract of my code:
(...)
Dim MyChart As Chart
Dim ChartName As String
ChartName = "Open/Closed"
Set MyChart = Sheets("datenfuerauswahlfelder").Shapes.AddChart(xlColumnStacked).Chart
For Each s In MyChart.SeriesCollection
s.Delete
Next s
MyChart.SeriesCollection.Add _
Source:=Worksheets("datenfuerauswahlfelder").Range("p4:s4")
MyChart.SeriesCollection(1).HasDataLabels = True
MyChart.SeriesCollection(1).Name = "Priority 2"
MyChart.SeriesCollection(1).XValues = Sheets("datenfuerauswahlfelder").Range("P2:s2")
MyChart.Refresh
MyChart.SeriesCollection.NewSeries
MyChart.SeriesCollection(2).HasDataLabels = True
MyChart.SeriesCollection(2).Name = "Priority 1"
MyChart.SeriesCollection(2).Values = Sheets("datenfuerauswahlfelder").Range("P3:S3")
MyChart.ChartArea.Format.TextFrame2.TextRange.Font.Size = 13
MyChart.Refresh
With MyChart.Parent
.Height = 330
.Width = 540
End With
Dim imageName As String
imageName = Application.DefaultFilePath & Application.PathSeparator & "TempChart.jpeg"
MyChart.Export Filename:=imageName, FilterName:="jpeg"
(...)
greetings
I've just made it to create a chart in a userform by creating the chart in the background (in the table) and exporting it as a jpeg-file saved locally. this is actually the only solution i've found in the internet so far.
is it possible to do this without creating a new jpeg file on the hard drive ? so i just wanna create a chart in the table and have it shown as an image in my userform.. or like saving the image temporarily in a table if possible. here is an extract of my code:
(...)
Dim MyChart As Chart
Dim ChartName As String
ChartName = "Open/Closed"
Set MyChart = Sheets("datenfuerauswahlfelder").Shapes.AddChart(xlColumnStacked).Chart
For Each s In MyChart.SeriesCollection
s.Delete
Next s
MyChart.SeriesCollection.Add _
Source:=Worksheets("datenfuerauswahlfelder").Range("p4:s4")
MyChart.SeriesCollection(1).HasDataLabels = True
MyChart.SeriesCollection(1).Name = "Priority 2"
MyChart.SeriesCollection(1).XValues = Sheets("datenfuerauswahlfelder").Range("P2:s2")
MyChart.Refresh
MyChart.SeriesCollection.NewSeries
MyChart.SeriesCollection(2).HasDataLabels = True
MyChart.SeriesCollection(2).Name = "Priority 1"
MyChart.SeriesCollection(2).Values = Sheets("datenfuerauswahlfelder").Range("P3:S3")
MyChart.ChartArea.Format.TextFrame2.TextRange.Font.Size = 13
MyChart.Refresh
With MyChart.Parent
.Height = 330
.Width = 540
End With
Dim imageName As String
imageName = Application.DefaultFilePath & Application.PathSeparator & "TempChart.jpeg"
MyChart.Export Filename:=imageName, FilterName:="jpeg"
(...)
greetings