Sub DelRepeat() "VBE/工具/引用/Microsoft Forms 2.0 Obejct Library Dim myDataObject As New MSForms.DataObject Dim strAlls As String, myString As String Dim i As Long, lngLenth As Long, oText As String ActiveDocument.Content.Cut myDataObject.GetFromClipboard strAlls = myDataObject.GetText(1) Set myDataObject = Nothing lngLenth = Len(strAlls) For i = 1 To lngLenth oText = VBA.Mid(strAlls, i, 1) If VBA.InStr(myString, oText) = 0 Then myString = myString & oText Next ActiveDocument.Content.Text = myString End Sub 自己提取有用的吧
Sub DelRepeat() "VBE/工具/引用/Microsoft Forms 2.0 Obejct Library Dim myDataObject As New MSForms.DataObject Dim strAlls As String, myString As String Dim i As Long, lngLenth As Long, oText As String ActiveDocument.Content.Cut myDataObject.GetFromClipboard strAlls = myDataObject.GetText(1) Set myDataObject = Nothing lngLenth = Len(strAlls) For i = 1 To lngLenth oText = VBA.Mid(strAlls, i, 1) If VBA.InStr(myString, oText) = 0 Then myString = myString & oText Next ActiveDocument.Content.Text = myString End Sub 自己提取有用的吧