I have the following code (VBA for PowerPoint 2010) to create a slide at the end of a presentation and insert title text:
longSlideCount = ActivePresentation.Slides.Count
With ActivePresentation.Slides
Set slideObject = .Add(longSlideCount + 1, ppLayoutTitleOnly)
End With
slideObject.Shapes.Title.TextFrame.TextRange.Text = "This is the Main Title Text"
I would like to know how to:
- Insert 'Subtitle' text (smaller font, on a new line immediately below the main title text)
- Change the font and size of the main title text and the subtitle text
Thanks in advance!!!
You can do it in several ways depending on how you want the slide to look. The easiest may be to use the
ppLayoutTitle
instead ofppLayoutTitleOnly
. It has two textframes instead of one, so you could update the text by using something like the following:If you need a more custom layout, you could add a new textbox by using adding the following at the bottom of your code example:
The numeric parameters to the
AddTextbox
function set the position and size of the new textbox.You can update the font the same way for both of the above examples (just change the reference to the textbox):