changing font of text in all slides using PowerPoint VBA, macros
Hello all,
I am trying to set font properties to every text in presentation at same time. I tried doing this with help of following code I found on web. But I am not able to change font present in slides textboxes, charts, tables. Please help! Here the values are taken from this : https://docs.microsoft.com/en-us/off...laceholdertype
with this code, I can influence title and subtitle but remaining body/content part of slides are not affecting. Any help is like ray of light!!Sorce : from internet ( not sure what website it is)
Sub SetFonts()
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 = 4 Then
If oshp.HasTextFrame Then
If oshp.TextFrame.HasText Then
With oshp.TextFrame.TextRange.Font
.Name = "Calibr"
.Size = 36
End With
End If
End If
End If
If oshp.PlaceholderFormat.Type = 2 Or oshp.PlaceholderFormat.Type = 12 Then
If oshp.HasTextFrame Then
If oshp.TextFrame.HasText Then
'This changes the font type and size.change values as required
With oshp.TextFrame.TextRange.Font
.Name = "Calibri"
.Size = 24
End With
End If
End If
End If
End If
Next oshp
Next osld
End Sub
Re: changing font of text in all slides using PowerPoint VBA, macros
Re: changing font of text in all slides using PowerPoint VBA, macros
Hello,
Thank you for the information. I am trying to achieve something that is similar to the code in stack overflow( above mentioned). But with a twist of setting different font sizes to texts. Like, I wish to set 24 font size to title text, 20 for subtitle text, 14 for text present in body, like content with paragraphs and all. Any thoughts on this is so helpful. My thought is to check for type using IF condition and apply respective changes.
Re: changing font of text in all slides using PowerPoint VBA, macros
My thought is to check for type using IF condition and apply respective changes, without using 'selection'.
Re: changing font of text in all slides using PowerPoint VBA, macros
Quote:
without using 'selection'.
i would think that would be much better