|
楼主 |
发表于 2023-3-27 18:24
|
显示全部楼层
'自己贴一下,详见附件。
'''''''''''''''''''''''''''''''''''下面做替换!不成功
Set re_in = CreateObject("VBscript.regexp")
With CreateObject("VBscript.regexp")
.Global = True:
.IgnoreCase = True
.MultiLine = True
.Pattern = "共和"
For Each IP In ActiveDocument.Paragraphs ''无法运行!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
' Set Mat = .Execute(IP.Range.Text)
For Each mt In .Execute(wrdDoc.Content.Text) '.Execute(IP.Range.Text)
' K = K + 1
MM = mt.FirstIndex: NN = mt.Length
Set oRang = ActiveDocument.Range(IP.Range.Start + MM, IP.Range.Start + MM + NN)
oRang.Text = "" '替换成空格,即删除
Next
Next
End With
'''''''''''''''''''''''''''''''''''下面做删除!不成功
Do While APPWD.Selection.Find.Execute(FindText:="共和", Forward:=True) 'And u < 3 '如果找到数据为0的设备对应的主导文本的内容,这句有问题!!!,下标超限后,就会不断删除,形成死循环!
APPWD.Selection.Parent.Expand 3 'wdSentence''无法运行!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
APPWD.Selection.Bookmarks ("\line") ''无法运行!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
APPWD.Selection.Parent.Range.Delete
APPWD.Selection.HomeKey Unit:=6
Loop
'''''''''''''''''''''''''''''''''''下面做删除!不成功
Dim oRng As Range
With wrdDoc.Tables(1)
pp = .Rows.Count
BB = .Range.Start - 2
cc = .Range.End 'Selection.Range.Text
Dim r As Range
.Range.Previous(4, 1).Select '一个段落
Selection.Delete ''删除无效!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
End With '
|
|