【发布时间】:2015-03-29 21:18:15
【问题描述】:
我在第二张幻灯片中有一个 PowerPoint 文件和一个图表。 在 Excel 文件中编写宏时,我无法设置图表的高度和宽度。下面是我正在尝试的代码。请注意,我只需要从 Excel 宏中修改高度和宽度。
Sub controlPPT()
Dim PPT As Object
Set PPT = CreateObject("PowerPoint.Application")
With Application.FileDialog(1)
.AllowMultiSelect = False
.Show
.Filters.Clear
.Filters.Add "PPT files", "*.pptx"
.FilterIndex = 1
If .SelectedItems.Count > 0 Then
Set slideTwo = PPT.ActivePresentation.Slides(2)
slideTwo.Shapes(1).Chart.PlotArea.Height = 120
slideTwo.Shapes(1).Chart.PlotArea.Width = 200
slideTwo.Shapes(1).Chart.PlotArea.Left = 0
slideTwo.Shapes(1).Chart.PlotArea.Top = 0
End If
End With
End Sub
【问题讨论】: