|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub SplitAndApplyFormatPainter()
- Dim slide As slide
- Dim shape As shape
- Dim textBox As shape
- Dim text As String
- Dim i As Integer
- ' 设置当前幻灯片
- Set slide = ActivePresentation.Slides(1) ' 更改为您想要拆分文本框的幻灯片索引
- ' 设置文本框
- Set shape = slide.Shapes("文本框 10") ' 更改为您想要拆分的文本框名称
- shape.PickUp
- ' 获取文本框内容
- text = shape.TextFrame.TextRange.text
- ' 拆分文本为单个字,并创建新的文本框
- For i = 1 To Len(text)
- ' 创建新文本框
- Set textBox = slide.Shapes.AddTextbox(msoTextOrientationHorizontal, shape.Left + (i - 1) * shape.Width / Len(text), shape.Top, shape.Width / Len(text), shape.Height)
- ' 设置文本框内容与格式
- With textBox
- .TextFrame.TextRange.text = Mid(text, i, 1)
- .Apply
- End With
- Next i
- End Sub
复制代码
|
|