bro*_*or1 1 excel vba excel-vba
我有从excel运行的VBA代码,该代码使用从excel文档复制到图表中生成6张幻灯片的PowerPoint演示文稿。我将使用哪些代码行插入标题幻灯片,并在该幻灯片上定义文本(标题+子标题)?使用Excel 2007。
因此,@ 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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
18351 次 |
| 最近记录: |