楼主,请打开 Word 文档,执行下面的宏,然后,用鼠标勾选表格内的所有文字,复制粘贴到 Excel 即可:
- Sub test台词()
- With ActiveDocument.Content.Find
- .Execute "[^13^11]", , , 1, , , , , , "^p", 2
- .Execute "\)", , , 1, , , , , , ")", 2
- .Execute "\(", , , 1, , , , , , "(", 2
- End With
- With Selection
- .WholeStory
- CommandBars.FindControl(ID:=122).Execute
- .ClearFormatting
- End With
- Dim i As Paragraph
- For Each i In ActiveDocument.Paragraphs
- If i.Range.Text = vbCr Then i.Range.Delete: GoTo sk
- If i.Range Like "[!(]*" Then i.Range.Delete: GoTo sk
- If i.Range Like "*)*" Then
- i.Range.Characters(InStr(i.Range, ")")).InsertAfter Text:=vbTab
- End If
- sk:
- Next
- '''
- With Selection
- .WholeStory
- .ConvertToTable Separator:=wdSeparateByTabs, NumColumns:=2, AutoFitBehavior:=wdAutoFitFixed
- .Tables(1).Style = "网格型"
- .HomeKey Unit:=wdStory
- End With
- If MsgBox("是否删除括号和双引号?", 4 + 16) = vbYes Then
- With ActiveDocument.Content.Find
- .Execute "[()]", , , 1, , , , , , "", 2
- .Execute "[“”]", , , 1, , , , , , "", 2
- End With
- End If
- End Sub
复制代码 |