VBAのプロパティやメソッドを探る時、
マクロ記録を使う方法
そんなお話をダラダラ撮った動画
youtu.be
https://youtu.be/dENBobeb5lY
です。
プログラム作成の参考となれば幸いです。
はてなの質問
q.hatena.ne.jp
の回答用に作成したコードと動画です。
下記、動画で記録されたコードとテストで使ったコードです
Sub Macro1() ' ' マクロ記録日: 2019/11/1 ユーザー名: Ken3 O ' ActiveWindow.Selection.SlideRange.Shapes("Rectangle 2").Select ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Select ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Characters(Start:=1, Length:=0).Select With ActiveWindow.Selection.TextRange .Text = "aaaa" With .Font .NameAscii = "Arial" .NameFarEast = "MS Pゴシック" .NameOther = "Arial" .Size = 44 .Bold = msoFalse .Italic = msoFalse .Underline = msoFalse .Shadow = msoFalse .Emboss = msoFalse .BaselineOffset = 0 .AutoRotateNumbers = msoTrue .Color.SchemeColor = ppTitle End With End With ActiveWindow.Selection.SlideRange.Shapes("Rectangle 3").Select ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Select ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Characters(Start:=1, Length:=0).Select With ActiveWindow.Selection.TextRange .Text = "bbbb" With .Font .NameAscii = "Arial" .NameFarEast = "MS Pゴシック" .NameOther = "Arial" .Size = 32 .Bold = msoFalse .Italic = msoFalse .Underline = msoFalse .Shadow = msoFalse .Emboss = msoFalse .BaselineOffset = 0 .AutoRotateNumbers = msoTrue .Color.SchemeColor = ppForeground End With End With ActiveWindow.Selection.Unselect End Sub Sub Macro2() ' ' マクロ記録日: 2019/11/1 ユーザー名: Ken3 O ' ActiveWindow.View.GotoSlide Index:=ActivePresentation.Slides.Add(Index:=2, Layout:=ppLayoutText).SlideIndex ActiveWindow.Selection.SlideRange.Shapes("Rectangle 2").Select ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Select ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Characters(Start:=1, Length:=0).Select With ActiveWindow.Selection.TextRange .Text = "aaaaaaa" With .Font .NameAscii = "Arial" .NameFarEast = "MS Pゴシック" .NameOther = "Arial" .Size = 44 .Bold = msoFalse .Italic = msoFalse .Underline = msoFalse .Shadow = msoFalse .Emboss = msoFalse .BaselineOffset = 0 .AutoRotateNumbers = msoTrue .Color.SchemeColor = ppTitle End With End With ActiveWindow.Selection.SlideRange.Shapes("Rectangle 3").Select ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Select ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Characters(Start:=1, Length:=0).Select With ActiveWindow.Selection.TextRange .Text = "zzzz" + Chr$(CharCode:=13) + "xxxx" + Chr$(CharCode:=13) With .Font .NameAscii = "Arial" .NameFarEast = "MS Pゴシック" .NameOther = "Arial" .Size = 32 .Bold = msoFalse .Italic = msoFalse .Underline = msoFalse .Shadow = msoFalse .Emboss = msoFalse .BaselineOffset = 0 .AutoRotateNumbers = msoTrue .Color.SchemeColor = ppForeground End With End With End Sub Sub test() Dim n As Integer '新規プレゼンのファイル作成 Presentations.Add WithWindow:=msoTrue 'スライドの数 n = ActivePresentation.Slides.Count + 1 'スライドの追加 ActiveWindow.View.GotoSlide Index:=ActivePresentation.Slides.Add(Index:=n, Layout:=3).SlideIndex 'タイトル 一番目のオブジェクトにテキストセット ActiveWindow.Selection.SlideRange.Shapes(1).TextFrame.TextRange.Text = "Ken3 TEST999そそそ" 'スライドの数 n = ActivePresentation.Slides.Count + 1 'スライドの追加 ActiveWindow.View.GotoSlide Index:=ActivePresentation.Slides.Add(Index:=n, Layout:=3).SlideIndex 'タイトル 一番目のオブジェクトにテキストセット ActiveWindow.Selection.SlideRange.Shapes(1).TextFrame.TextRange.Text = "page 2" End Sub Sub Macro3() ' ' マクロ記録日: 2019/11/1 ユーザー名: Ken3 O ' ActivePresentation.Slides.Add(Index:=7, Layout:=ppLayoutTitleOnly).Select ActiveWindow.Selection.SlideRange.Layout = ppLayoutTwoColumnText ActivePresentation.Slides.Add(Index:=8, Layout:=ppLayoutTwoColumnText).Select End Sub Sub Macro4() ' ' マクロ記録日: 2019/11/1 ユーザー名: Ken3 O ' Presentations.Add WithWindow:=msoTrue ActiveWindow.View.GotoSlide Index:=ActivePresentation.Slides.Add(Index:=1, Layout:=ppLayoutTitle).SlideIndex End Sub