VBA Word扩展每个发现两行的出现

时间:2017-03-21 16:52:49

标签: vba

尝试将视频标题文本合并到一个段落中,我想删除所有空白行,并添加2行。例如:

1
00:00:04,350 - > 00:00:07609
本教程将介绍如何无缝转移

2
00:00:07,609 - > 00:00:11059个
从Revit结构到ETABS的模型

等,我的结果是:本教程将展示如何 将模型从Revit结构无缝转移到ETABS,......

我最好的尝试是并且给出了不完整的结果:(

Sub DelExpandEmpty()
 Dim oPara As Word.Paragraph
 Dim var
 For Each oPara In ActiveDocument.Paragraphs
    If Len(oPara.Range) = 1 Then
        oPara.Range.Select
        Selection.MoveDown unit:=wdLine, Count:=3
        Selection.Expand wdLine
        Selection.Delete
    End If
 Next
End Sub

1 个答案:

答案 0 :(得分:1)

我认为应该是:

Selection.MoveDown Unit:=wdLine, Count:=2, Extend:=wdExtend