Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vba 粘贴到PowerPoint时保留图表格式_Vba_Excel_Excel Charts - Fatal编程技术网

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时,如何确定图表的格式?谢谢

如何存储图表的尺寸(宽度和高度)并将其应用于幻灯片上的形状?问题不在于尺寸,而在于图表本身的格式。不过我已经加上了。