PowerPoint でいくつかの楕円形 (既に作成され配置されている図形) にテキストを追加しようとしています。値は Excel から読み取られます。また、PowerPoint の図形の色を変更したいと思います。値が 0 より大きい場合は緑に、0 より小さい場合は赤になります。これを試していますが、エラーが発生します。どんな助けでも大歓迎です。私は最初にAlt-H、S、L、Pを実行し、名前をダブルクリックしてOval11、Oval12などに変更しています。
バージョン:エクセル2010、パワーポイント2010
'Code starts
Sub AutomateMIS()
'Declare variables
Dim oPPTApp As PowerPoint.Application
Dim oPPTFile As PowerPoint.Presentation
Dim oPPTShape As PowerPoint.Shape
Dim oPPTSlide As PowerPoint.Slide
Dim SlideNum As Integer
'Instatntiate Powerpoint and make it visble
Set oPPTApp = CreateObject("PowerPoint.Application")
oPPTApp.Visible = msoTrue
'Opening an existing presentation
Set oPPTFile = oPPTApp.Presentations.Open(Filename:=ThisWorkbook.Path & "\" & "MIS.pptx")
'Some Code before this
SlideNum=1
i=3
'Update Ovals on next slide
Set oPPTShape = oPPTFile.Slides(SlideNum + 1).Shapes("Oval11")
oPPTShape.TextFrame.TextRange.Text = c.Offset(, 5).Value
Set oPPTShape = oPPTFile.Slides(SlideNum + 1).Shapes("Oval12")
oPPTShape.TextFrame.TextRange.Text = c.Offset(, 7).Value
Set oPPTShape = oPPTFile.Slides(SlideNum + 1).Shapes("Oval" & (i + 1) & "3")
oPPTShape.TextFrame.TextRange.Text = c.Offset(, 8).Value
Set oPPTShape = oPPTFile.Slides(SlideNum + 1).Shapes("Oval" & (i + 1) & "4")
oPPTShape.TextFrame.TextRange.Text = c.Offset(, 9).Value
End Sub