我处理的问题是,在复制到powerpoint幻灯片时,我的VBA代码选择不包括整个图表。我有以下代码:
此代码根据2个数字创建我的甜甜圈图表。
Function CreateTwoValuesPie(ByVal X As Long, ByVal Y As Long) As Chart
'Returnerer
Set CreateTwoValuesPie = charts.Add
CreateTwoValuesPie.ChartType = XlChartType.xlDoughnut
With CreateTwoValuesPie.SeriesCollection.NewSeries
.Values = Array(X, Y)
End With
With CreateTwoValuesPie
.ChartArea.Format.Fill.Visible = msoFalse
.ChartArea.Format.Line.Visible = msoFalse
.Legend.Delete
.ChartGroups(1).DoughnutHoleSize = 70
With .SeriesCollection(1)
.Points(1).Format.Fill.ForeColor.RGB = RGB(255, 158, 77) 'Score Orange
.Points(2).Format.Fill.ForeColor.RGB = RGB(175, 171, 170) '10 - Score Grå
.Format.Line.ForeColor.RGB = RGB(255, 255, 255)
End With
End With
End Function
此代码存储不同的对象和数字:
Set oPPTApp = CreateObject("PowerPoint.Application")
Set oPPTFile = oPPTApp.Presentations.Open(PP)
Set oPPTShape10 = oPPTFile.Slides(1)
d11 = Format(Dashboard.EAScore1.Caption, "Standard")
Set ch1 = CreateTwoValuesPie(d11, 10 - d11)
ch1.CopyPicture Appearance:=xlScreen, Size:=xlScreen, Format:=xlPicture
With oPPTShape10.Shapes.Paste
.Top = 127
.Width = 177
.Left = 393
End With
代码工作正常并从数字(d11,10-d11)创建正确的图表但是当我复制图形并将其插入我的powerpoint幻灯片oPPTShape10时,它只复制图表的一部分。
几天前它有用,从那以后我没有改变任何东西?有谁知道我怎么能让它显示整个数字而不仅仅是它的顶部?