Vba 粘贴到PowerPoint时保留图表格式
我使用了以下函数来制作和格式化我的图表Vba 粘贴到PowerPoint时保留图表格式,vba,excel,excel-charts,Vba,Excel,Excel Charts,我使用了以下函数来制作和格式化我的图表 Function CreateTwoValuesPie(ByVal x As Long, ByVal Y As Long) As Chart Set CreateTwoValuesPie = charts.Add CreateTwoValuesPie.ChartType = XlChartType.xlDoughnut With CreateTwoValuesPie.SeriesCollection.NewSeries .Values =
Function CreateTwoValuesPie(ByVal x As Long, ByVal Y As Long) As Chart
Set CreateTwoValuesPie = charts.Add
CreateTwoValuesPie.ChartType = XlChartType.xlDoughnut
With CreateTwoValuesPie.SeriesCollection.NewSeries
.Values = Array(x, Y)
End With
With CreateTwoValuesPie
.ChartGroups(1).DoughnutHoleSize = 20
.ChartArea.Format.Fill.Visible = msoFalse
.Legend.Delete
End With
End Function
我正试图将图表复制到PowerPoint幻灯片中,但看起来孔大小的格式也没有被复制。我正在使用以下代码创建、复制图表并将其粘贴到powerpoint中
Set oPPTShape10 = oPPTFile.Slides(1)
'EarlyAdoption
d11 = Format(Dashboard.EAScore1.Caption, "Standard")
Set ch = CreateTwoValuesPie(d11, 10 - d11)
With ch
.CopyPicture _
Appearance:=xlScreen, Size:=xlScreen, Format:=xlPicture
End With
With oPPTShape10.Shapes.Paste
.Top = 200
.Left = 200
.Width = 300
End With
代码给出了PowerPoint中的以下图表。
这显然没有我想要的20号洞。复制到PowerPoint时,如何确定图表的格式?谢谢 如何存储图表的尺寸(宽度和高度)并将其应用于幻灯片上的形状?问题不在于尺寸,而在于图表本身的格式。不过我已经加上了。