1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
Sub comparetab()
'
' Macro enregistrée le 11/12/2007 par FR54835
'
Dim tabnew As Table, tabold As Table
Dim i As Integer, j As Integer, k As Integer, l As Integer, find As Integer
Dim linvalnew As String, linvalold As String
Dim docnew As Document, docold As Document
Dim objworld As Word.Application
Set tabnew = Selection.Tables(1)
Windows("doc2.doc").Activate
Set tabold = Selection.Tables(1)
Windows("doc1.doc").Activate
For i = 1 To tabnew.Rows.Count
find = 0
linvalnew = ""
For j = 1 To tabnew.Columns.Count
linvalnew = linvalnew & tabnew.Cell(i, j).Range
Next j
Windows("doc2.doc").Activate
For k = tabold.Rows.Count To 1 Step -1
linvalold = ""
For l = 1 To tabold.Columns.Count
linvalold = linvalold & tabold.Cell(k, l).Range
Next l
If linvalold = linvalnew Then
find = 1
End If
Next k
Windows("doc1.doc").Activate
If find = 0 Then
With tabnew.Rows(i)
With .Shading
.BackgroundPatternColor = wdColorYellow
End With
End With
End If
Next i
End Sub |
Partager