|
-
Jun 27th, 2019, 12:55 PM
#1
Thread Starter
Junior Member
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
-
Jun 27th, 2019, 02:35 PM
#2
Re: changing font of text in all slides using PowerPoint VBA, macros
-
Jun 28th, 2019, 08:45 AM
#3
Thread Starter
Junior Member
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.
-
Jun 28th, 2019, 08:47 AM
#4
Thread Starter
Junior Member
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'.
-
Jun 28th, 2019, 05:41 PM
#5
Re: changing font of text in all slides using PowerPoint VBA, macros
without using 'selection'.
i would think that would be much better
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|