Hi all,
I'm trying to change all the text in a pptx (using Office 2010) to Times New Roman 24 pt. I'm not good with code. I found this on
http://www.pptalchemy.co.uk/vbasamples.html :
But I got an out of range error: oshp.TextFrame.TextRange.Font <The specified error is out of range>.
Can someone help me? Thanks!
Regards,
Jay
Code:
Sub allchange()
Dim osld As Slide, oshp As Shape
For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
If oshp.Type = msoPlaceholder Then
'Title text change values as required
If oshp.PlaceholderFormat.Type = 1 Or oshp.PlaceholderFormat.Type = 3 Then
With oshp.TextFrame.TextRange.Font
.Name = "Times New Roman"
.Size = 24
.Color.RGB = RGB(0, 0, 255)
.Bold = msoFalse
.Italic = msoFalse
.Shadow = False
End With
End If
If oshp.PlaceholderFormat.Type = 2 Or oshp.PlaceholderFormat.Type = 7 Then
'Body text change values as required
With oshp.TextFrame.TextRange.Font
.Name = "Times New Roman (Body)"
.Size = 24
.Color.RGB = RGB(0, 0, 255)
.Bold = msoFalse
.Italic = msoFalse
.Shadow = False
End With
End If
End If
Next oshp
Next osld
End Sub