|
呵呵,杜先生 那么厉害,怎么会看不懂,是不愿意折腾啊! 我先折腾一下,杜先生 再出手吧!
——顺便问一下:杜先生,我昨天在网上找了好久,也不知道 这个“不间断空格^s”在《正则表达式》中怎么写,另三个空格我都解决了。
——楼主,以后要把表格的属性设置为“不文字环绕”,否则,影响排版啊!请试试我写的小宏:
(营运证号、车架号 不想要,自己在代码中删除即可)
Sub 校验码()
On Error Resume Next
Dim doc As Document, t As Table, i&, y$, c$, a$
Set doc = ActiveDocument
For Each t In ActiveDocument.Tables
t.Rows.WrapAroundText = False
Next
Do
i = i + 1
Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:=i
Selection.Find.ClearFormatting
Selection.Find.Execute "营运车辆尺寸勘验表", , , 0, , , , , , "", 0
y = doc.Tables(i).Cell(3, 4).Range.Text
y = Right(Left(y, Len(y) - 2), 5)
c = doc.Tables(i).Cell(4, 2).Range.Text
c = Right(Left(c, Len(c) - 2), 5)
a = "(" & Format(Date, "yyyy年m月d日") & "+营运证号" & y & "+车架号" & c & ")"
Selection.InsertAfter Text:="`"
Selection.MoveStart unit:=wdCharacter, Count:=Len(Selection) - 1
Selection = a
Selection.Font.Size = 10.5
Loop Until i = ActiveDocument.ComputeStatistics(wdStatisticPages)
End Sub |
|