[英]Shift text in Power Point 2007 text box using VBA
I need to shift the position of text in all textboxes (1 textbox per slide). 我需要移动所有文本框中的文本位置(每张幻灯片1个文本框)。 The subtitles' first language is in white and there's English in yellow.
字幕的第一语言为白色,英语为黄色。 Now I'd like yellow to be on top, white below.
现在我希望黄色在上面,白色在下面。 So first I'd like to select white, copy, erase, go to the end of yellow and paste (with line break between white/yellow).
因此,首先我要选择白色,复制,擦除,转到黄色末尾并粘贴(在白色/黄色之间换行)。 Can it be done?
能做到吗
Maybe some change to such script would help? 也许对此类脚本进行一些更改会有所帮助?
Sub RemoveWhiteText()
Dim oSl As Slide
Dim oSh As Shape
With ActivePresentation
For Each oSl In .Slides
For Each oSh In oSl.Shapes
With oSh
If .HasTextFrame Then
If .TextFrame.HasText Then
If TextRange.Font.Color = vbWhite Then
oSh.TextFrame.Text
End If
End If
End If
End With
Next
Next
End With
End Sub
This will move the first run with font color white to the end of the text box. 这会将带有白色字体颜色的第一次运行移到文本框的末尾。 Try this:
尝试这个:
Sub MoveWhiteTextToEnd(oSh As Shape) With oSh With oSh.TextFrame.TextRange.Runs(1) If .Font.Color.RGB = vbWhite Then .Cut oSh.TextFrame.TextRange.InsertAfter (vbCrLf) oSh.TextFrame.TextRange.Characters(oSh.TextFrame.TextRange.Length + 1).Paste End If End With End With End Sub
Update your code with this call: 通过此调用更新代码:
If .TextFrame.HasText Then Call MoveWhiteTextToEnd(oSh) End If
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.