|
附件没看.有兴趣可以试一下这个:
Sub DescSortParagraphs()
Dim objData As New MSForms.DataObject
Dim strCopy As String
Dim astrPara() As String
Dim astrNewPara() As String
Dim L As Long
Dim N As Long
On Error Resume Next
objData.GetFromClipboard
strCopy = objData.GetText(1)
If Len(strCopy) > 0 Then ''''成功取得剪贴板中的数据
astrPara = Split(strCopy, vbCrLf) ''''分隔符视具体情况而定
For L = UBound(astrPara) To 0 Step -1
If Len(astrPara(L)) > 0 Then ''''删除空行
ReDim Preserve astrNewPara(0 To N)
astrNewPara(N) = astrPara(L)
N = N + 1
End If
Next
End If
If N > 0 Then ActiveDocument.Content.Text = Join(astrNewPara, Chr$(13))
End Sub
如果不会修改代码,请先剪切文档中的内容至剪贴板后运行本代码.如果会修改,可以视网页内容中的换行标记在剪贴板中的具体ASC值,从而可以直接处理. |
|