[VBA PowerPoint] TextRangeのLinesとPragraphsの差
shp.TextFrame.TextRange.Paragraphs
Public Sub TestGetParagraphs()
'''' *********************************************************
''
Dim shp As Shape
Set shp = ActivePresentation.Slides.item(4).Shapes.placeholders.item(2)
''Console.dump shp
Dim i As Long
For i = 1 To shp.TextFrame.TextRange.Paragraphs.Count
Console.log i
Console.log shp.TextFrame.TextRange.Paragraphs(i).indentLevel
Console.log shp.TextFrame.TextRange.Paragraphs(i).Text
Next i
''
End Sub
results of execution
[DEBUG] 1
[DEBUG] 1
[DEBUG] VBA
[DEBUG] 2
[DEBUG] 2
[DEBUG] Syntax
[DEBUG] 3
[DEBUG] 2
[DEBUG] Primitive
[DEBUG] 4
[DEBUG] 3
[DEBUG] String / Long / Boolean / Variant / Object
[DEBUG] 5
[DEBUG] 3
[DEBUG] String() / Long() / Boolean() / Variant() / Object()
Public Sub TestGetLines()
'''' *********************************************************
''
Dim shp As Shape
Set shp = ActivePresentation.Slides.item(5).Shapes.placeholders.item(2)
''Console.dump shp
Dim i As Long
For i = 1 To shp.TextFrame.TextRange.Lines.Count
Console.log i
Console.log shp.TextFrame.TextRange.Lines(i).indentLevel
Console.log shp.TextFrame.TextRange.Lines(i).Text
Next i
[DEBUG] 1
[DEBUG] 1
[DEBUG] VBA
[DEBUG] 2
[DEBUG] 2
[DEBUG] Syntax
[DEBUG] 3
[DEBUG] 2
[DEBUG] Primitive
[DEBUG] 4
[DEBUG] 3
[DEBUG] String / Long / Boolean / Variant / Object
[DEBUG] 5
[DEBUG] 3
[DEBUG] String() / Long() / Boolean() / Variant() /
[DEBUG] 6
[DEBUG] 3
[DEBUG] Object()
System Development業界、Software Engineering、Scriptingについて、発信してます。サポートありがとうございます。