|
楼主,你只说18位身份证号码的问题,并未连带其它数据,所以我只针对这18个数字用 VBA 宏完成,若你懂得 VBA 宏代码运行,请试试:(必须选中一段数字,再应用此宏)
Sub 数字加框()
'将身份证号码放在表格单元格中(位数不限)
Dim i As Long
If Selection.Type = wdSelectionIP Then MsgBox "请选定数字!", vbOKOnly + vbCritical, "数字加框": End
i = Len(Selection) - 1
If i <> 18 Then If MsgBox("警告!选定数字并非18位二代身份证号码,是否继续?", vbYesNo + vbCritical, "数字加框") = vbNo Then End
Selection.HomeKey Unit:=wdLine
Do
Selection.MoveRight Unit:=wdCharacter, Count:=2, Extend:=wdExtend
If Asc(Selection.Characters.Last) = 13 Then Exit Do
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeText Text:=" "
Loop
Selection.Paragraphs(1).Range.Select
Selection.ConvertToTable Separator:=4, NumColumns:=i, NumRows:=1, AutoFitBehavior:=wdAutoFitFixed
Selection.Tables(1).Style = "网格型"
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.Cells.VerticalAlignment = wdCellAlignVerticalCenter
Selection.MoveLeft Unit:=wdCharacter, Count:=1
End Sub |
|