Option Explicit Sub daili() Dim i As Paragraph, x As Integer, myrange As Range, r1 As Range x = 1 If Application.ActiveDocument.Tables.Count < 1 Then MsgBox "不存在表格" Exit Sub End If With Application.ActiveDocument.Tables(1) .Columns(3).Delete .ConvertToText Separator:=wdSeparateByTabs End With Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting Set myrange = Application.ActiveDocument.Range With myrange.Find .Text = "??:" .Replacement.Text = ":" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True End With myrange.Find.Execute Replace:=wdReplaceAll For Each i In Application.ActiveDocument.Paragraphs If i.Range.Find.Execute(findtext:=":80") = True Then Else i.Range.Delete End If Next With myrange.Find .Execute findtext:="^t", replacewith:="", Format:=False, Replace:=wdReplaceAll .Execute findtext:="HTTP", replacewith:="@HTTP#", Replace:=wdReplaceAll End With End Sub
iruKfc09.rar
(78.05 KB, 下载次数: 10)
该宏的目的是将附件中的代理表格格式进行转换,转换成固定格式。 第三列为时间,没有实际意思,删去。 最后转化成如下格式 192.168.1.1:8080@HTTP#备注 . . . 即冒号后面是端口号,@后是协议,#后是备注 最后存为纯文本格式。 我自己做了一个代码,代理少的时候还可以将就,如附件那么多,非死不可。 大侠帮我优化一下,或者直接重写一个,谢谢! 再谢! |