|
- Sub shishi()
- Dim tb As Table, tbl As Table, c As Cell, rng As Range
- For Each tb In ActiveDocument.Tables
- If tb.Tables.Count > 0 Then
- For Each c In tb.Range.Cells
- For Each tbl In c.Tables
- m = Split(tbl.Range.Cells(1).Range, Chr(13) & Chr(7))(0)
- n = Split(tbl.Range.Cells(2).Range, Chr(13) & Chr(7))(0)
- tbl.Delete
- c.Range = Replace(Split(c.Range, Chr(13) & Chr(7))(0), Chr(13), "")
- With c.Range
- .End = .End - 1: .Collapse 0
- Set rng = ActiveDocument.Range(.Start, .End)
- rng.Fields.Add rng, -1, "eq \f(" & m & "," & n & ")", 0
- End With
- Next
- Next
- End If
- If tb.Rows.Count > 1 Then
- With tb.Range
- m = Split(.Cells(1).Range, Chr(13) & Chr(7))(0)
- n = Split(.Cells(2).Range, Chr(13) & Chr(7))(0)
- tb.Delete
- Set rng = ActiveDocument.Range(.Start, .End)
- rng.Fields.Add rng, -1, "eq \f(" & m & "," & n & ")", 0
- End With
- End If
- Next
- End Sub
复制代码 |
|