How to change an existing Tabstop in PowerPoint by VBA?

475 Views Asked by At

I have a VBA Code to resize objects in PowerPoint including Font size, margins and everything else. But I haven’t found a solution to update/change an existing TapStop. There is a the Ruler Object with different levels und a default value. I double checked also the TextRange Object with Characters.

Are there any ideas to update the TabStop size?

Here is an example of a TextBox, i would like to resize:

TextBox Example

Shape.textframe.ruler.tabstops.count is always 0, if I "take" just the shape by For-Each-Loop. If I select it manual, it's also 0 at the sub menu TabStops of Paragraph menu. If I click inside the shape (blinking cursor) and open the TabStops menu again, I see one TabStopPosition.

How can I access this information by VBA?

I tried it already by Line.Selection and nothing works.

Thanks!

Moe

1

There are 1 best solutions below

1
Steve Rindsberg On BEST ANSWER

PowerPoint used to allow only one set of paragraph settings per textframe (ie, per shape). That changed in PPT2007; now each paragraph can have its own tab and other settings. Have a go with this:

Sub ShowMeTabs()

Dim X As Long
Dim lTabCount As Long

    With ActiveWindow.Selection.ShapeRange(1).TextFrame2.TextRange
        For X = 1 To .Paragraphs.Count
            Debug.Print X
            With .Paragraphs(X).ParagraphFormat
                For lTabCount = 1 To .TabStops.Count
                    Debug.Print .TabStops(lTabCount).Position
                Next    ' Tab
                Debug.Print "Level:" & .IndentLevel & " Position:" & .LeftIndent 'etc

            End With
        Next    ' paragraph x
    End With

End Sub