View Single Post
 
Old 10-20-2011, 08:25 AM
ghumdinger ghumdinger is offline Windows 7 Office 2010 (Version 14.0)
Advanced Beginner
 
Join Date: Jul 2010
Posts: 64
ghumdinger is on a distinguished road
Default oshp.TextFrame.TextRange.Font <The specified error is out of range>

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
Reply With Quote