如何将内容占位符逐行拆分为文本形状 powerpoint 2010
How to split the content placeholder line by line into a text shape powerpoint 2010
我是 vb 和 power point 的新手,正在尝试 运行 power point 2010 中的宏。我想要实现的是,当宏是 运行 时,它应该 逐行拆分内容占位符区域中的内容,并将每一行放在一个新的文本框形状中。
我做了一些工作,但无法继续前进。宏功能如下
Sub HelloWorldMacro()
Dim Sld As Slide
Dim Shp As Shape
' Current slide
Set Sld = ActivePresentation.Slides(ActiveWindow.View.Slide.SlideIndex)
For Each s In Sld.Shapes
' Condition - not to grab contents from title area.
If s.Name <> "Title 1" Then
If s.HasTextFrame Then
With s.TextFrame
If .HasText Then MsgBox .TextRange.Text
End With
End If
End If
Next
End Sub
有了这个,我就可以将内容区域中的文本抓取到消息框中。但无法将其拆分并放置在文本形状区域中。
也尝试了一些形状创建功能,但无法将它们组合起来。
Sub create_shape()
Dim Sld As Slide
Dim Shp As Shape
Set Sld = ActivePresentation.Slides(ActiveWindow.View.Slide.SlideIndex)
Set Shp = Sld.Shapes.AddShape(Type:=msoShapeRectangle, _
Left:=24, Top:=65.6, Width:=672, Height:=26.6)
Shp.Name = "My Header"
Shp.Line.Visible = msoFalse
Shp.Fill.ForeColor.RGB = RGB(184, 59, 29)
End Sub
这将向您展示如何获取文本框中的每一行或每一段:
Sub LineByLine()
Dim oSh As Shape
Dim x As Long
' for example only:
Set oSh = ActiveWindow.Selection.ShapeRange(1)
With oSh.TextFrame.TextRange
For x = 1 To .Paragraphs.Count
MsgBox .Paragraphs(x).Text
Next
For x = 1 To .Lines.Count
MsgBox .Lines(x).Text
Next
End With
End Sub
我是 vb 和 power point 的新手,正在尝试 运行 power point 2010 中的宏。我想要实现的是,当宏是 运行 时,它应该 逐行拆分内容占位符区域中的内容,并将每一行放在一个新的文本框形状中。
我做了一些工作,但无法继续前进。宏功能如下
Sub HelloWorldMacro()
Dim Sld As Slide
Dim Shp As Shape
' Current slide
Set Sld = ActivePresentation.Slides(ActiveWindow.View.Slide.SlideIndex)
For Each s In Sld.Shapes
' Condition - not to grab contents from title area.
If s.Name <> "Title 1" Then
If s.HasTextFrame Then
With s.TextFrame
If .HasText Then MsgBox .TextRange.Text
End With
End If
End If
Next
End Sub
有了这个,我就可以将内容区域中的文本抓取到消息框中。但无法将其拆分并放置在文本形状区域中。
也尝试了一些形状创建功能,但无法将它们组合起来。
Sub create_shape()
Dim Sld As Slide
Dim Shp As Shape
Set Sld = ActivePresentation.Slides(ActiveWindow.View.Slide.SlideIndex)
Set Shp = Sld.Shapes.AddShape(Type:=msoShapeRectangle, _
Left:=24, Top:=65.6, Width:=672, Height:=26.6)
Shp.Name = "My Header"
Shp.Line.Visible = msoFalse
Shp.Fill.ForeColor.RGB = RGB(184, 59, 29)
End Sub
这将向您展示如何获取文本框中的每一行或每一段:
Sub LineByLine()
Dim oSh As Shape
Dim x As Long
' for example only:
Set oSh = ActiveWindow.Selection.ShapeRange(1)
With oSh.TextFrame.TextRange
For x = 1 To .Paragraphs.Count
MsgBox .Paragraphs(x).Text
Next
For x = 1 To .Lines.Count
MsgBox .Lines(x).Text
Next
End With
End Sub