Excel ドキュメントからコピーしたグラフを使用して 6 スライドのパワーポイント プレゼンテーションを生成する Excel から VBA コードを実行しています。タイトル スライドを挿入し、そのスライドのテキスト (タイトル + サブ タイトル) を定義するには、どのコード行を使用すればよいでしょうか? エクセル2007を使用。
			
			21808 次
		
4 に答える
            5        
        
		
したがって、@Siddharth Rout 提案の追加の代替案 (これも良いことです)。.AddTitleその形状をフォーマットする場合に役立つメソッド  を使用します。
Sub add_title()
Dim shpCurrShape As Shape
Dim ppPres As Presentation
Set ppPres = ActivePresentation
With ppPres.Slides(1)
If Not .Shapes.HasTitle Then
    Set shpCurrShape = .Shapes.AddTitle
Else
    Set shpCurrShape = .Shapes.Title
End If
    With shpCurrShape
    With .TextFrame.TextRange
        '~~> Set text here
        .Text = "BLAH BLAH"
        '~~> Alignment
        .ParagraphFormat.Alignment = 3
       '~~> Working with font
       With .Font
          .Bold = msoTrue
          .Name = "Tahoma"
          .Size = 24
          .Color = RGB(0, 0, 0)
       End With
    End With
End With
End With
End Sub
于 2013-03-29T19:40:03.320   に答える
    
    
            2        
        
		
を使用し.AddTextboxてタイトルを追加する必要があります
この例を参照してください
Dim shpCurrShape As Object
'~~> If doing from within PP remove oPPApp else it is your PP object
With oPPApp.ActivePresentation.Slides(1)
    '~~> Add Heading
    'expression.AddTextbox(Orientation, Left, Top, Width, Height)
    Set shpCurrShape = .Shapes.AddTextbox(1, 18, 48, 654, 29.08126)
    With shpCurrShape
        With .TextFrame.TextRange
            '~~> Set text here
            .Text = "BLAH BLAH"
            '~~> Alignment
            .ParagraphFormat.Alignment = 3
           '~~> Working with font
           With .Font
              .Bold = msoTrue
              .Name = "Tahoma"
              .Size = 24
              .Color = RGB(0, 0, 0)
           End With
        End With
    End With
End With
スクリーンショット

于 2013-03-29T19:24:19.473   に答える
    
    
            0        
        
		
私が使用する解決策は次のとおりです。
'Setup PPTX File
Set oPA = CreateObject("PowerPoint.Application")
oPA.Visible = True
Set oPP = oPA.ActivePresentation
slideNumber = oPP.Slides.Count + 1
Set oPS = oPP.Slides.Add(slideNumber, ppLayoutBlank)
oPA.ActiveWindow.View.GotoSlide (slideNumber) 'this line makes testing easier otherwise not required
Set sObj = oPP.Slides(slideNumber)
sObj.Shapes(1).TextFrame.TextRange.Text = titleText
 'Include Text in Powerpoint
oPP.Slides(slideNumber).CustomLayout = oPP.Designs(1).SlideMaster.CustomLayouts(X) 'X=Layout Number with a title page
sObj.Shapes(1).TextFrame.TextRange.Text = titleText
于 2017-12-01T04:28:58.097   に答える