Avatar of Jamie Garroch (MVP)
Jamie Garroch (MVP)Flag for United Kingdom of Great Britain and Northern Ireland

asked on 

Why does .Paragraphs.Count return 1 for a Title Placeholder that has more than one paragraph?

I'm using VBA in PowerPoint to format the Title placeholders within a presentation.

I want to treat the first and second paragraphs within the placeholder differently.

But, when I use this construct, I only ever see a paragraph count of 1, even though there are multiple paragraphs (each separated by a carriage return) in my title placeholder:

Dim oSld as Slide
Dim iPara as Integer

For Each oSld In ActivePresentation.Slides
  If oSld.Shapes.HasTitle Then
    With oSld.Shapes.Title.TextFrame2.TextRange
      For iPara = 1 To .Paragraphs.count

Open in new window

Example title placeholder text:

This is paragraph 1
This is paragraph 2

If I copy the text from the placeholder to a standard text box, .Paragraphs.Count returns the correct number of paragraphs.

Why is the OM not returning the right number of paragraphs for a Title Placeholder?

.Lines.Count appears to work but that may not always yield paragraphs e.g. if the font size causes overflow.
Microsoft PowerPointVisual Basic ClassicMicrosoft Office

Avatar of undefined
Last Comment
John Wilson
Avatar of Jamie Garroch (MVP)
Jamie Garroch (MVP)
Flag of United Kingdom of Great Britain and Northern Ireland image


I think I've discovered why this isn't working. It appears that Title Placeholders do not support the Carriage Return (13) character. What is actually inserted when the user presses return is a Vertical Tab (11) character and perhaps .Paragraphs.Count is only looking for character 13. Even if I paste text from a text box where CR (13) is used as the line feed character, it is transposed to Vertical Tab (11) when pasted into the Title Placeholder. I've rewritten my code to not use the OM .Paragraphs or .Line and instead am now searching for the occurrence of vbVerticalTab.
Avatar of John Wilson
John Wilson
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Jamie Garroch (MVP)


Thanks for confirming that JSRWilson. FYI, Enter in a Title Palceholder inserts a Vertical Tab char 11 (not sure if that's the same as Soft Return as I thought that was char 10).
Avatar of John Wilson
John Wilson
Flag of United Kingdom of Great Britain and Northern Ireland image

I've always called SHIFT ENTER a soft return. Not sure that's the correct name but it is chr (11) VertTab
Visual Basic Classic
Visual Basic Classic

Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.

Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews


IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo