This repository has been archived by the owner on Dec 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vba_ConStance.vbs
1127 lines (1007 loc) · 49.4 KB
/
vba_ConStance.vbs
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Option Explicit
Dim CSX As String
Dim colIndex As String
Dim rowIndex As Integer
Dim inputPPN As String
Dim folderPath As String
Dim fileName As String
Dim mainWorkBook As Workbook
Sub read_Sudoc_Data()
'Pour tout ce qui touche au XML en VB et au Sudoc MarcXML
'http://documentation.abes.fr/sudoc/manuels/administration/aidewebservices/#SudocMarcXML
'https://excel-macro.tutorialhorizon.com/vba-excel-read-data-from-xml-file/
'https://www.mrexcel.com/board/threads/reading-xml-into-excel-with-vba.822719/
'https://software-solutions-online.com/excel-vba-get-data-from-web-using-msxml/
'https://stackoverflow.com/questions/19194544/selectsinglenode-using-vbscript#answer-19195587
Dim nbPPN As Integer, count As Integer, jj As Integer
Dim oXMLFile As Object, XMLFileName As String
mainWorkBook.Worksheets("Introduction").Activate
nbPPN = Application.WorksheetFunction.CountA(Range("I:I"))
count = 0
For jj = 2 To nbPPN
If Cells(jj + count, 9).Value <> "" Then
'Rajoute les 0 devant le PPN si nécessaire
inputPPN = Right(Cells(jj + count, 9).Value, 9)
While Len(inputPPN) < 9
inputPPN = "0" & inputPPN
Wend
'Crée l'URL et la charge
Dim URL As String
Select Case CSX
Case "[CS2]", "[CS3]", "[CS4]", "[CS5]", "[CS6]", "[CS7]"
URL = "https://www.sudoc.fr/" & inputPPN & ".xml"
Case "[CS1]"
URL = "https://www.idref.fr/" & inputPPN & ".xml"
Case Else
MsgBox "La valeur entrée en H2 ne devrait pas être possible"
End Select
Set oXMLFile = CreateObject("Microsoft.XMLDOM")
XMLFileName = URL
oXMLFile.async = False
oXMLFile.Load (XMLFileName)
'Lance le bon script
Select Case CSX
Case "[CS2]"
ctrlUB700S3 oXMLFile, mainWorkBook, jj
Case "[CS1]"
ctrlUA103eqUA200f oXMLFile, mainWorkBook, jj
Case "[CS3]"
ctrlUB7XXS3 oXMLFile, mainWorkBook, jj
Case "[CS4]"
getUBAge oXMLFile, mainWorkBook, jj
Case "[CS5]"
getUBAge100 oXMLFile, mainWorkBook, jj
Case "[CS6]"
getEdition oXMLFile, mainWorkBook, jj
Case "[CS7]"
getUBAgeDD oXMLFile, mainWorkBook, jj
Case Else
MsgBox "La valeur entrée en H2 ne devrait pas être possible"
End Select
Else
'Gère la boucle en cas de cellule vide
count = count + 1
jj = jj - 1
End If
Next
'Formattage cellules
With mainWorkBook.Sheets("Résultats").Range("A2:" & colIndex & (jj + count - 1))
.BorderAround LineStyle:=xlContinuous, Weight:=xlThin
.Borders(xlInsideVertical).LineStyle = XlLineStyle.xlContinuous
.Borders(xlInsideHorizontal).LineStyle = XlLineStyle.xlContinuous
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
End With
mainWorkBook.Worksheets("Résultats").Activate
Range("A:" & colIndex).RemoveDuplicates Columns:=Array(1), Header:=xlYes
rowIndex = jj - 1
End Sub
Sub formatEnTetes()
'https://www.automateexcel.com/vba/format-cells/
'Crée les en-têtes pour la feuille "Résultats"
mainWorkBook.Worksheets("Résultats").Activate
Select Case CSX
Case "[CS2]"
Range("A1").Value = "PPN"
Range("B1").Value = "UB700[0]"
Range("C1").Value = "Résultat"
colIndex = "C"
Case "[CS1]"
Range("A1").Value = "PPN"
Range("B1").Value = "UA103a"
Range("C1").Value = "UA200f1"
Range("D1").Value = "Note birth date"
Range("E1").Value = "UA103b"
Range("F1").Value = "UA200f2"
Range("G1").Value = "Note death date"
Range("H1").Value = "Résultat"
Range("I1").Value = "Note"
colIndex = "I"
Case "[CS3]"
Range("A1").Value = "PPN"
Range("B1").Value = "UB7XX[0]"
Range("C1").Value = "Résultat"
colIndex = "C"
Case "[CS4]", "[CS5]"
Range("A1").Value = "PPN"
Range("B1").Value = "Année (la plus élevée)"
Range("D1").Value = "Année moyenne"
Range("E1").Value = "Année médianne"
Range("F1").Value = "Nb titres exclus"
colIndex = "B"
Case "[CS6]"
Range("A1").Value = "PPN"
Range("B1").Value = "Édition"
Range("C1").Value = "Titre"
Range("D1").Value = "Clef de titre"
Range("E1").Value = "Cat. clef titre"
Range("F1").Value = "PPN ment. resp."
Range("G1").Value = "Résultats"
colIndex = "G"
Case "[CS7]"
Range("A1").Value = "PPN"
Range("B1").Value = "Année 21X (la plus élevée)"
Range("C1").Value = "Année 100 (la plus élevée)"
Range("E1").Value = "Année moyenne 21X"
Range("F1").Value = "Année médianne 21X"
Range("G1").Value = "Nb titres exclus 21X"
Range("E3").Value = "Année moyenne 100"
Range("F3").Value = "Année médianne 100"
Range("G3").Value = "Nb titres exclus 100"
colIndex = "C"
Case Else
MsgBox "La valeur entrée en H2 ne devrait pas être possible"
End Select
With mainWorkBook.Worksheets("Résultats").Range("A1:" & colIndex & "1")
.Interior.Color = RGB(0, 0, 0)
.HorizontalAlignment = xlCenter
.Font.Color = RGB(255, 255, 255)
End With
'Pour éviter que les PPN deviennent des nombres
Range("A:" & colIndex).NumberFormat = "@"
End Sub
Sub ctrlUB700S3(oXMLFile, mainWorkBook, jj)
Dim dollar As String, output As String, PPN, PPNval As String
Dim UB700Node
'Récupère le PPN et sort de la fonction s'il y a une erreur liée au PPN
Set PPN = oXMLFile.SelectSingleNode("/record/controlfield[@tag='001']/text()")
If Not PPN Is Nothing Then
PPNval = PPN.NodeValue
Else
PPNval = "ERREUR [entrée n°" & jj & " : " & Chr(10) & inputPPN & "]"
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":C" & jj).Interior.Color = RGB(0, 0, 0)
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":C" & jj).Font.Color = RGB(255, 255, 255)
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":C" & jj).Value = PPNval
Exit Sub
End If
Set UB700Node = oXMLFile.SelectSingleNode("/record/datafield[@tag='700']/subfield[0]")
If Not UB700Node Is Nothing Then
dollar = UB700Node.getAttribute("code")
Else
dollar = "PAS DE 700"
End If
output = ""
If dollar = "3" Then
output = "OK"
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":C" & jj).Interior.Color = RGB(146, 208, 80)
Else
output = "Problème"
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":C" & jj).Interior.Color = RGB(255, 0, 0)
End If
mainWorkBook.Sheets("Résultats").Range("B" & jj).Value = dollar
mainWorkBook.Sheets("Résultats").Range("A" & jj).Value = PPNval
mainWorkBook.Sheets("Résultats").Range("C" & jj).Value = output
'Unload oXMLFile(XMLFileName)
End Sub
Sub ctrlUB7XXS3(oXMLFile, mainWorkBook, jj)
Dim dollar As String, output As String, PPN, PPNval As String, mismatchCount As Integer
Dim UB7XXNodes, kk As Integer, parentNode
'Récupère le PPN et sort de la fonction s'il y a une erreur liée au PPN
Set PPN = oXMLFile.SelectSingleNode("/record/controlfield[@tag='001']/text()")
If Not PPN Is Nothing Then
PPNval = PPN.NodeValue
Else
PPNval = "ERREUR [entrée n°" & jj & " : " & Chr(10) & inputPPN & "]"
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":C" & jj).Interior.Color = RGB(0, 0, 0)
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":C" & jj).Font.Color = RGB(255, 255, 255)
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":C" & jj).Value = PPNval
Exit Sub
End If
mismatchCount = 0
Set UB7XXNodes = oXMLFile.SelectNodes("/record/datafield[@tag>=700 and @tag<800]/subfield[0]")
If Not UB7XXNodes Is Nothing Then
For kk = 0 To (UB7XXNodes.Length - 1)
Set parentNode = UB7XXNodes(kk).parentNode
dollar = appendNote(dollar, "[" & kk & "] " & parentNode.getAttribute("tag") & " 1er $ : " & UB7XXNodes(kk).getAttribute("code"))
If Right(dollar, 1) <> "3" Then
If InStr(output, "Problème") = 0 Then
output = "Problème"
End If
output = appendNote(output, "occ. [" & kk & "]")
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":C" & jj).Interior.Color = RGB(255, 0, 0)
End If
Next
Else
dollar = "PAS DE 7XX"
End If
If InStr(output, "Problème") = 0 Then
output = "OK"
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":C" & jj).Interior.Color = RGB(146, 208, 80)
'Permet de dire quels champs sont pbatiques
Else
End If
mainWorkBook.Sheets("Résultats").Range("B" & jj).Value = dollar
mainWorkBook.Sheets("Résultats").Range("A" & jj).Value = PPNval
mainWorkBook.Sheets("Résultats").Range("C" & jj).Value = output
'Unload oXMLFile(XMLFileName)
End Sub
Sub ctrlUA103eqUA200f(oXMLFile, mainWorkBook, jj)
'ATTENTION ELLE NE PREND QUE LE 1ER UA200 S'IL Y EN A PLUSIEURS
'à terme je rajouterai date de mort je pense
'et un meilleur handling de
Dim UA103a As String, UA103b As String, UA200f As String, UA200f1 As String, UA200f2 As String, moveRight As Integer, UA103aNode, UA103bNode, UA200fNode
Dim result As String, note As String, birthNote As String, deathNote As String, PPN, PPNval As String
'Récupère le PPN et sort de la fonction s'il y a une erreur liée au PPN
Set PPN = oXMLFile.SelectSingleNode("/record/controlfield[@tag='001']/text()")
If Not PPN Is Nothing Then
PPNval = PPN.NodeValue
Else
PPNval = "ERREUR [entrée n°" & jj & " : " & Chr(10) & inputPPN & "]"
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":I" & jj).Interior.Color = RGB(0, 0, 0)
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":I" & jj).Font.Color = RGB(255, 255, 255)
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":I" & jj).Value = PPNval
Exit Sub
End If
note = ""
'Récupération 103a
Set UA103aNode = oXMLFile.SelectSingleNode("/record/datafield[@tag='103']/subfield[@code='a']/text()")
If Not UA103aNode Is Nothing Then
'Apparement il y a des espaces en 103a
UA103a = Replace(UA103aNode.NodeValue, " ", "")
If Left(UA103a, 1) = "-" Then
birthNote = appendNote(birthNote, "Date av. J.-C. en UA103a")
UA103a = Mid(UA103a, 2, 4)
Else
UA103a = Left(UA103a, 4)
End If
If InStr(UA103aNode.NodeValue, "?") > 0 Then
birthNote = appendNote(birthNote, "Date incertaine en UA103a")
UA103a = UA103a
End If
Else
UA103a = "PAS DE UA103a"
End If
'Récupération 103b
Set UA103bNode = oXMLFile.SelectSingleNode("/record/datafield[@tag='103']/subfield[@code='b']/text()")
If Not UA103bNode Is Nothing Then
UA103b = Replace(UA103bNode.NodeValue, " ", "")
If Left(UA103b, 1) = "-" Then
deathNote = appendNote(deathNote, "Date av. J.-C. en UA103b")
UA103b = Mid(UA103b, 2, 4)
Else
UA103b = Left(UA103b, 4)
End If
If InStr(UA103bNode.NodeValue, "?") > 0 Then
deathNote = appendNote(deathNote, "Date incertaine en UA103b")
UA103b = UA103b
End If
Else
UA103b = "PAS DE UA103b"
End If
'Récupération des 200f
Set UA200fNode = oXMLFile.SelectSingleNode("/record/datafield[@tag='200']/subfield[@code='f']/text()")
If Not UA200fNode Is Nothing Then
moveRight = 0
'Naissance
UA200f = UA200fNode.NodeValue
If InStr(UA200f, "av") > 0 Then
birthNote = appendNote(birthNote, "Date av. J.-C. en UA200f1")
deathNote = appendNote(deathNote, "Date av. J.-C. en UA200f2")
End If
If Left(UA200f, 1) = "-" Then
birthNote = appendNote(birthNote, "Date av. J.-C. en UA200f1")
moveRight = moveRight + 1
End If
UA200f1 = Mid(UA200f, 1 + moveRight, 4)
If Mid(UA200f, 5 + moveRight, 1) = "?" Then
birthNote = appendNote(birthNote, "Date incertaine en UA200f1")
moveRight = moveRight + 1
End If
'Mort
If Len(UA200f) >= (9 + moveRight) Then
If Mid(UA200f, 10 + moveRight, 1) = "?" Then
deathNote = appendNote(deathNote, "Date incertaine en UA200f2")
End If
UA200f2 = Mid(UA200f, 6 + moveRight, 4)
Else
deathNote = appendNote(deathNote, "Pb death date UA200f")
mainWorkBook.Sheets("Résultats").Range("E" & jj).Interior.Color = RGB(0, 176, 240)
End If
Else
UA200f1 = "PAS DE UA200f"
UA200f2 = "PAS DE UA200f"
End If
'Comparaison des années de naissance
If Replace(Replace(UA103a, ".", "X"), "?", "X") = Replace(Replace(UA200f1, ".", "X"), "?", "X") Then
result = "OK"
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":I" & jj).Interior.Color = RGB(146, 208, 80)
ElseIf (InStr(UA103a, "PAS DE") > 0) And ((InStr(UA200f1, "PAS DE") > 0) Or (UA200f1 = "....")) Then
result = "OK"
note = appendNote(note, "Pas de birth date")
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":I" & jj).Interior.Color = RGB(146, 208, 80)
Else
result = "Diff."
note = appendNote(note, "Pas de corresp. birth date")
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":I" & jj).Interior.Color = RGB(255, 0, 0)
End If
'Comparaison des années de mort
If (InStr(UA103b, "PAS DE") > 0) And ((InStr(UA200f2, "PAS DE") > 0) Or (UA200f2 = "....")) Then
note = appendNote(note, "Pas de death date")
ElseIf Replace(Replace(UA103b, "X", "."), "?", ".") <> Replace(Replace(UA200f2, "X", "."), "?", ".") Then
result = "Diff."
note = appendNote(note, "Pas de corresp. death date")
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":I" & jj).Interior.Color = RGB(255, 0, 0)
End If
'Vérification du format des données
If UA103a <> Replace(Replace(UA103a, ".", "X"), "?", "X") Then
birthNote = appendNote(birthNote, "Format d'année incorrect en UA103a")
mainWorkBook.Sheets("Résultats").Range("B" & jj).Interior.Color = RGB(0, 176, 240)
End If
If UA200f1 <> Replace(Replace(UA200f1, "X", "."), "?", ".") Then
birthNote = appendNote(birthNote, "Format d'année incorrect en UA200f")
mainWorkBook.Sheets("Résultats").Range("C" & jj).Interior.Color = RGB(0, 176, 240)
End If
If UA103b <> Replace(Replace(UA103b, ".", "X"), "?", "X") Then
deathNote = appendNote(deathNote, "Format d'année incorrect en UA103b")
mainWorkBook.Sheets("Résultats").Range("E" & jj).Interior.Color = RGB(0, 176, 240)
End If
If UA200f2 <> Replace(Replace(UA200f2, "X", "."), "?", ".") Then
deathNote = appendNote(deathNote, "Format d'année incorrect en UA200f")
mainWorkBook.Sheets("Résultats").Range("F" & jj).Interior.Color = RGB(0, 176, 240)
End If
If note <> "" And InStr(note, "corresp.") = 0 Then
mainWorkBook.Sheets("Résultats").Range("I" & jj).Interior.Color = RGB(0, 176, 240)
ElseIf InStr(note, "corresp.") > 0 Then
mainWorkBook.Sheets("Résultats").Range("I" & jj).Interior.Color = RGB(255, 0, 0)
End If
If birthNote <> "" Then
'Si les deux dates sont marquées comme incertaines
If Abs(InStr(birthNote, "incertain") - Len(birthNote)) <> InStrRev(birthNote, "incertain") And _
InStr(birthNote, "incertain") <> 0 Then
birthNote = appendNote(Replace(Replace(birthNote, "Date incertaine en UA200f1", ""), "Date incertaine en UA103a", ""), "Birth date incertaine")
End If
'Si les deux dates sont marquées comme av. J.-C.
If Abs(InStr(birthNote, "av. J.-C.") - Len(birthNote)) <> InStrRev(birthNote, "av. J.-C.") And _
InStr(birthNote, "av. J.-C.") <> 0 Then
birthNote = appendNote(Replace(Replace(birthNote, "Date av. J.-C. en UA200f1", ""), "Date av. J.-C. en UA103a", ""), "Birth date av. J.-C.")
End If
mainWorkBook.Sheets("Résultats").Range("D" & jj).Interior.Color = RGB(0, 176, 240)
'Enlève les retours à la ligne résiduels
While InStr(birthNote, Chr(10) & Chr(10)) > 0
birthNote = Replace(birthNote, Chr(10) & Chr(10), Chr(10))
Wend
If Left(birthNote, 1) = Chr(10) Then
birthNote = Right(birthNote, Len(birthNote) - 1)
End If
End If
If deathNote <> "" Then
'Si les deux dates sont marquées comme incertaines
If Abs(InStr(deathNote, "incertain") - Len(deathNote)) <> InStrRev(deathNote, "incertain") And _
InStr(deathNote, "incertain") <> 0 Then
deathNote = appendNote(Replace(Replace(deathNote, "Date incertaine en UA200f2", ""), "Date incertaine en UA103b", ""), "Death date incertaine")
End If
'Si les deux dates sont marquées comme av. J.-C.
If Abs(InStr(deathNote, "av. J.-C.") - Len(deathNote)) <> InStrRev(deathNote, "av. J.-C.") And _
InStr(deathNote, "av. J.-C.") <> 0 Then
deathNote = appendNote(Replace(Replace(deathNote, "Date av. J.-C. en UA200f2", ""), "Date av. J.-C. en UA103b", ""), "Death date av. J.-C.")
End If
mainWorkBook.Sheets("Résultats").Range("G" & jj).Interior.Color = RGB(0, 176, 240)
'Enlève les retours à la ligne résiduels
While InStr(deathNote, Chr(10) & Chr(10)) > 0
deathNote = Replace(deathNote, Chr(10) & Chr(10), Chr(10))
Wend
If Left(deathNote, 1) = Chr(10) Then
deathNote = Right(deathNote, Len(deathNote) - 1)
End If
End If
mainWorkBook.Sheets("Résultats").Range("A" & jj).Value = PPNval
mainWorkBook.Sheets("Résultats").Range("B" & jj).Value = UA103a
mainWorkBook.Sheets("Résultats").Range("C" & jj).Value = UA200f1
mainWorkBook.Sheets("Résultats").Range("D" & jj).Value = birthNote
mainWorkBook.Sheets("Résultats").Range("E" & jj).Value = UA103b
mainWorkBook.Sheets("Résultats").Range("F" & jj).Value = UA200f2
mainWorkBook.Sheets("Résultats").Range("G" & jj).Value = deathNote
mainWorkBook.Sheets("Résultats").Range("H" & jj).Value = result
mainWorkBook.Sheets("Résultats").Range("I" & jj).Value = note
'Unload oXMLFile(XMLFileName)
End Sub
Sub getUBAge(oXMLFile, mainWorkBook, jj)
Dim annee As String, anneeReW As String, output As String, PPN, PPNval As String
Dim UB21XNodes, kk As Integer, ll As Integer
'Récupère le PPN et sort de la fonction s'il y a une erreur liée au PPN
Set PPN = oXMLFile.SelectSingleNode("/record/controlfield[@tag='001']/text()")
If Not PPN Is Nothing Then
PPNval = PPN.NodeValue
Else
PPNval = "ERREUR [entrée n°" & jj & " : " & Chr(10) & inputPPN & "]"
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":B" & jj).Interior.Color = RGB(0, 0, 0)
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":B" & jj).Font.Color = RGB(255, 255, 255)
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":B" & jj).Value = PPNval
Exit Sub
End If
Set UB21XNodes = oXMLFile.SelectNodes("/record/datafield[@tag=214 or @tag=210]/subfield[@code='d']")
output = ""
If Not UB21XNodes Is Nothing Then
For kk = 0 To (UB21XNodes.Length - 1)
annee = UB21XNodes(kk).text()
annee = Replace(annee, " ", "")
annee = Replace(annee, "DL", "")
annee = Replace(annee, "C", "")
annee = Replace(annee, "cop", "")
annee = Replace(annee, "P", "")
annee = Replace(annee, ".", "")
annee = Replace(annee, ",", "")
annee = Replace(annee, "-", "")
annee = Replace(annee, "?", "")
annee = Replace(annee, "(", "")
annee = Replace(annee, ")", "")
'Si après cette première vague, du texte est encore présent, une détection caratère à caractère est effectuée
If IsNumeric(annee) = False Then
For ll = 1 To Len(annee)
If IsNumeric(Mid(annee, ll, 1)) = True Then
anneeReW = anneeReW & Mid(annee, ll, 1)
If Len(anneeReW) = 8 Then
If Left(anneeReW, 4) < Right(anneeReW, 4) Then
anneeReW = Right(anneeReW, 4)
Else
anneeReW = Left(anneeReW, 4)
End If
End If
End If
Next
'Donne 0 à la valeur annnee pour éviter de poser problèmes plus tard
If anneeReW <> "" Then
annee = anneeReW
Else
annee = "0"
End If
End If
'Vérifie si l'année fait 4 chiffres (0 exclus), sinon essaye de voir si les 4 premiers chiffres font une année entre 1000 et 9999, sinon laisse vide
If CDbl(annee) > 2030 Or CDbl(annee) < 1900 Then
If CLng(Right(annee, 4)) < 2030 And CLng(Right(annee, 4)) > 1900 Then
annee = Right(annee, 4)
ElseIf CLng(Left(annee, 4)) < 2030 And CLng(Left(annee, 4)) > 1900 Then
annee = Left(annee, 4)
ElseIf CLng(annee) < 2030 And CLng(annee) > 1900 Then
annee = annee
Else
output = ""
End If
End If
'Regarde si une valeur est déjà présente. Si oui, regarde laquelle est la plus grande
If output <> "" Then
If CLng(annee) > CLng(output) Then
output = annee
End If
Else
output = annee
End If
Next
Else
output = ""
End If
'Colore les PPN qui n'ont pas eu d'années associées
If output = "" Or output = "0" Then
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":B" & jj).Interior.Color = RGB(255, 0, 0)
Else
mainWorkBook.Sheets("Résultats").Range("B" & jj).Value = CLng(output)
End If
mainWorkBook.Sheets("Résultats").Range("A" & jj).Value = PPNval
'Unload oXMLFile(XMLFileName)
End Sub
Sub getUBAgeDD(oXMLFile, mainWorkBook, jj)
Dim annee1 As String, annee2 As String, output As String, PPN, PPNval As String
Dim annee As String, anneeReW As String, output2 As String
Dim UB100Node, UB21XNodes, kk As Integer, ll As Integer
'100 est prioritaire
'Récupère le PPN et sort de la fonction s'il y a une erreur liée au PPN
Set PPN = oXMLFile.SelectSingleNode("/record/controlfield[@tag='001']/text()")
If Not PPN Is Nothing Then
PPNval = PPN.NodeValue
Else
PPNval = "ERREUR [entrée n°" & jj & " : " & Chr(10) & inputPPN & "]"
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":C" & jj).Interior.Color = RGB(0, 0, 0)
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":C" & jj).Font.Color = RGB(255, 255, 255)
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":C" & jj).Value = PPNval
Exit Sub
End If
'100
Set UB100Node = oXMLFile.SelectSingleNode("/record/datafield[@tag=100]/subfield[@code='a']/text()")
output = ""
If Not UB100Node Is Nothing Then
annee1 = Mid(UB100Node.NodeValue, 10, 4)
annee2 = Mid(UB100Node.NodeValue, 14, 4)
If IsNumeric(annee2) = True Then
If CInt(annee2) > CInt(annee1) And CInt(annee2) > 1900 And CInt(annee2) < 2030 Then
output = annee2
End If
End If
If CInt(annee1) > 1900 And CInt(annee1) < 2030 And output = "" Then
output = annee1
End If
End If
'Colore les PPN qui n'ont pas eu d'années associées en 100
If output = "" Or output = "0" Then
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":C" & jj).Interior.Color = RGB(255, 0, 0)
Else
mainWorkBook.Sheets("Résultats").Range("C" & jj).Value = CInt(output)
End If
'21X
Set UB21XNodes = oXMLFile.SelectNodes("/record/datafield[@tag=214 or @tag=210]/subfield[@code='d']")
output2 = ""
If Not UB21XNodes Is Nothing Then
For kk = 0 To (UB21XNodes.Length - 1)
annee = UB21XNodes(kk).text()
annee = Replace(annee, " ", "")
annee = Replace(annee, "DL", "")
annee = Replace(annee, "C", "")
annee = Replace(annee, "cop", "")
annee = Replace(annee, "P", "")
annee = Replace(annee, ".", "")
annee = Replace(annee, ",", "")
annee = Replace(annee, "-", "")
annee = Replace(annee, "?", "")
annee = Replace(annee, "(", "")
annee = Replace(annee, ")", "")
'Si après cette première vague, du texte est encore présent, une détection caratère à caractère est effectuée
If IsNumeric(annee) = False Then
For ll = 1 To Len(annee)
If IsNumeric(Mid(annee, ll, 1)) = True Then
anneeReW = anneeReW & Mid(annee, ll, 1)
If Len(anneeReW) = 8 Then
If Left(anneeReW, 4) < Right(anneeReW, 4) Then
anneeReW = Right(anneeReW, 4)
Else
anneeReW = Left(anneeReW, 4)
End If
End If
End If
Next
'Donne 0 à la valeur annnee pour éviter de poser problèmes plus tard
If anneeReW <> "" Then
annee = anneeReW
Else
annee = "0"
End If
End If
'Vérifie si l'année fait 4 chiffres (0 exclus), sinon essaye de voir si les 4 premiers chiffres font une année entre 1000 et 9999, sinon laisse vide
If CDbl(annee) > 2030 Or CDbl(annee) < 1900 Then
If CLng(Right(annee, 4)) < 2030 And CLng(Right(annee, 4)) > 1900 Then
annee = Right(annee, 4)
ElseIf CLng(Left(annee, 4)) < 2030 And CLng(Left(annee, 4)) > 1900 Then
annee = Left(annee, 4)
ElseIf CLng(annee) < 2030 And CLng(annee) > 1900 Then
annee = annee
Else
output2 = ""
End If
End If
'Regarde si une valeur est déjà présente. Si oui, regarde laquelle est la plus grande
If output2 <> "" Then
If CLng(annee) > CLng(output2) Then
output2 = annee
End If
Else
output2 = annee
End If
Next
Else
output2 = ""
End If
'Colore le 21X des PPN qui n'ont pas eu d'années associées en 21X
If output2 = "" Or output2 = "0" Then
mainWorkBook.Sheets("Résultats").Range("B" & jj & ":B" & jj).Interior.Color = RGB(255, 0, 0)
Else
mainWorkBook.Sheets("Résultats").Range("B" & jj).Value = CLng(output2)
End If
mainWorkBook.Sheets("Résultats").Range("A" & jj).Value = PPNval
'Unload oXMLFile(XMLFileName)
End Sub
Sub getUBAge100(oXMLFile, mainWorkBook, jj)
Dim annee1 As String, annee2 As String, output As String, PPN, PPNval As String
Dim UB100Node, kk As Integer, ll As Integer
'Récupère le PPN et sort de la fonction s'il y a une erreur liée au PPN
Set PPN = oXMLFile.SelectSingleNode("/record/controlfield[@tag='001']/text()")
If Not PPN Is Nothing Then
PPNval = PPN.NodeValue
Else
PPNval = "ERREUR [entrée n°" & jj & " : " & Chr(10) & inputPPN & "]"
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":B" & jj).Interior.Color = RGB(0, 0, 0)
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":B" & jj).Font.Color = RGB(255, 255, 255)
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":B" & jj).Value = PPNval
Exit Sub
End If
Set UB100Node = oXMLFile.SelectSingleNode("/record/datafield[@tag=100]/subfield[@code='a']/text()")
output = ""
If Not UB100Node Is Nothing Then
annee1 = Mid(UB100Node.NodeValue, 10, 4)
annee2 = Mid(UB100Node.NodeValue, 14, 4)
If IsNumeric(annee2) = True Then
If CInt(annee2) > CInt(annee1) And CInt(annee2) > 1900 And CInt(annee2) < 2030 Then
output = annee2
End If
End If
If CInt(annee1) > 1900 And CInt(annee1) < 2030 And output = "" Then
output = annee1
End If
End If
'Colore les PPN qui n'ont pas eu d'années associées
If output = "" Or output = "0" Then
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":B" & jj).Interior.Color = RGB(255, 0, 0)
Else
mainWorkBook.Sheets("Résultats").Range("B" & jj).Value = CInt(output)
End If
mainWorkBook.Sheets("Résultats").Range("A" & jj).Value = PPNval
'Unload oXMLFile(XMLFileName)
End Sub
Sub getStatsUBAge()
Dim nonEmptyRows As Integer
Dim yearDataRange As Range
mainWorkBook.Sheets("Résultats").Activate
Range("A:B").Sort key1:=Cells(2, 2), order1:=xlAscending, Header:=xlYes
nonEmptyRows = Application.WorksheetFunction.CountA(Range("B:B"))
Set yearDataRange = Range("B2:B" & nonEmptyRows)
Range("D2") = Application.WorksheetFunction.Average(yearDataRange)
Range("E2") = Application.WorksheetFunction.Median(yearDataRange)
Range("F2") = rowIndex - nonEmptyRows
End Sub
Sub getStatsUBAgeDD()
Dim nonEmptyRows As Integer
Dim yearDataRange As Range
mainWorkBook.Sheets("Résultats").Activate
Range("A:C").Sort key1:=Cells(2, 3), order1:=xlAscending, Header:=xlYes
'21X
nonEmptyRows = Application.WorksheetFunction.CountA(Range("B:B"))
Set yearDataRange = Range("B2:B" & nonEmptyRows)
Range("E2") = Application.WorksheetFunction.Average(yearDataRange)
Range("F2") = Application.WorksheetFunction.Median(yearDataRange)
Range("G2") = rowIndex - nonEmptyRows
'100
nonEmptyRows = Application.WorksheetFunction.CountA(Range("C:C"))
Set yearDataRange = Range("C2:C" & nonEmptyRows)
Range("E4") = Application.WorksheetFunction.Average(yearDataRange)
Range("F4") = Application.WorksheetFunction.Median(yearDataRange)
Range("G4") = rowIndex - nonEmptyRows
End Sub
Sub getEdition(oXMLFile, mainWorkBook, jj)
Dim kk As Integer, ll As Integer
Dim PPN, PPNval As String
Dim UB205, edition As String
Dim UB200a, UB200eNodes, titre As String, UB451Nodes, UB451oNodes, titre451 As String
Dim UB7XXNodes, UB7XXPPN, mentR As String
Dim clefTitre As String, catClefTitre As String
'Récupère le PPN et sort de la fonction s'il y a une erreur liée au PPN
Set PPN = oXMLFile.SelectSingleNode("/record/controlfield[@tag='001']/text()")
If Not PPN Is Nothing Then
PPNval = PPN.NodeValue
Else
PPNval = "ERREUR [entrée n°" & jj & " : " & Chr(10) & inputPPN & "]"
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":B" & jj).Interior.Color = RGB(0, 0, 0)
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":B" & jj).Font.Color = RGB(255, 255, 255)
mainWorkBook.Sheets("Résultats").Range("A" & jj & ":B" & jj).Value = PPNval
Exit Sub
End If
Set UB205 = oXMLFile.SelectSingleNode("/record/datafield[@tag='205']/subfield[@code='a']/text()")
If Not UB205 Is Nothing Then
edition = UB205.NodeValue
Else
edition = ""
End If
Set UB200a = oXMLFile.SelectSingleNode("/record/datafield[@tag='200']/subfield[@code='a']/text()")
If Not UB200a Is Nothing Then
titre = UB200a.NodeValue
Set UB200eNodes = oXMLFile.SelectNodes("/record/datafield[@tag='200']/subfield[@code='e']/text()")
If Not UB200eNodes Is Nothing Then
For kk = 0 To (UB200eNodes.Length - 1)
titre = titre & " : " & UB200eNodes(kk).NodeValue
Next
End If
Else
titre = ""
End If
Set UB451Nodes = oXMLFile.SelectNodes("/record/datafield[@tag='451']")
If Not UB451Nodes Is Nothing Then
For kk = 0 To (UB451Nodes.Length - 1)
Set UB451oNodes = UB451Nodes(kk).ChildNodes
titre451 = ""
For ll = 0 To (UB451oNodes.Length - 1)
If UB451oNodes(ll).getAttribute("code") = "t" And titre451 = "" Then
titre451 = UB451oNodes(ll).text
ElseIf UB451oNodes(ll).getAttribute("code") = "o" Then
titre451 = titre451 & " : " & UB451oNodes(ll).text
End If
Next
titre = appendNote(titre, titre451)
Next
End If
Set UB7XXPPN = oXMLFile.SelectNodes("/record/datafield[@tag>=700 and @tag<800]/subfield[@code='3']")
mentR = ""
If Not UB7XXPPN Is Nothing Then
For kk = 0 To (UB7XXPPN.Length - 1)
Set UB7XXNodes = UB7XXPPN(kk).parentNode
If UB7XXNodes.getAttribute("tag") < 710 Then
mentR = appendNote(mentR, UB7XXPPN(kk).text)
Else
mentR = appendNote(mentR, "C" & UB7XXPPN(kk).text)
End If
Next
End If
'Génère la clef et attribue sa catégorie
clefTitre = UCase(titre)
If Left(clefTitre, 4) = "LES " Or Left(clefTitre, 4) = "UNE " Or Left(clefTitre, 4) = "DES " Then
clefTitre = Right(clefTitre, Len(clefTitre) - 4)
ElseIf Left(clefTitre, 3) = "LE " Or Left(clefTitre, 3) = "LA " Or Left(clefTitre, 3) = "UN " Then
clefTitre = Right(clefTitre, Len(clefTitre) - 3)
ElseIf Left(clefTitre, 2) = "L'" Then
clefTitre = Right(clefTitre, Len(clefTitre) - 2)
End If
clefTitre = Replace(clefTitre, Chr(10) & "LE ", Chr(10))
clefTitre = Replace(clefTitre, Chr(10) & "LES ", Chr(10))
clefTitre = Replace(clefTitre, Chr(10) & "LA ", Chr(10))
clefTitre = Replace(clefTitre, Chr(10) & "UN ", Chr(10))
clefTitre = Replace(clefTitre, Chr(10) & "UNE ", Chr(10))
clefTitre = Replace(clefTitre, Chr(10) & "DES ", Chr(10))
clefTitre = Replace(clefTitre, Chr(10) & "L'", Chr(10))
clefTitre = Replace(clefTitre, " LE ", " ")
clefTitre = Replace(clefTitre, " LES ", " ")
clefTitre = Replace(clefTitre, " LA ", " ")
clefTitre = Replace(clefTitre, " L'", " ")
clefTitre = Replace(clefTitre, " UN ", " ")
clefTitre = Replace(clefTitre, " UNE ", " ")
clefTitre = Replace(clefTitre, " DES ", " ")
clefTitre = Replace(clefTitre, " À ", " ")
clefTitre = Replace(clefTitre, " DE ", " ")
clefTitre = Replace(clefTitre, ",", "")
clefTitre = Replace(clefTitre, ":", "")
clefTitre = Replace(clefTitre, ";", "")
clefTitre = Replace(clefTitre, "?", "")
clefTitre = Replace(clefTitre, "!", "")
clefTitre = Replace(clefTitre, ".", "")
clefTitre = Replace(clefTitre, "(", "")
clefTitre = Replace(clefTitre, ")", "")
clefTitre = Replace(clefTitre, "[", "")
clefTitre = Replace(clefTitre, "]", "")
clefTitre = Replace(clefTitre, """", "")
clefTitre = Replace(clefTitre, "&", "")
clefTitre = Replace(clefTitre, "=", "")
clefTitre = Replace(clefTitre, Chr(171), "")
clefTitre = Replace(clefTitre, Chr(187), "")
clefTitre = Replace(clefTitre, "'", "")
clefTitre = Replace(clefTitre, "-", " ")
While InStr(clefTitre, " ") > 0
clefTitre = Replace(clefTitre, " ", " ")
Wend
clefTitre = Trim(clefTitre)
clefTitre = Replace(clefTitre, " ", "_")
'Je passe la détection de la catégorie de la clef en fonction des titres maintenant (si il reste encore une clef)
'Select Case UBound(Split(clefTitre, "_")) + 1
' Case 0 To 3
' catClefTitre = "1 : >66 %"
' Case 4 To 7
' catClefTitre = "2 : >70 %"
' Case 8 To 12
' catClefTitre = "3 : >75 %"
' Case Else
' catClefTitre = "4 : >80 %"
'End Select
mainWorkBook.Sheets("Résultats").Range("A" & jj).Value = PPNval
mainWorkBook.Sheets("Résultats").Range("B" & jj).Value = edition
mainWorkBook.Sheets("Résultats").Range("C" & jj).Value = titre
mainWorkBook.Sheets("Résultats").Range("D" & jj).Value = clefTitre
'mainWorkBook.Sheets("Résultats").Range("E" & jj).Value = catClefTitre
mainWorkBook.Sheets("Résultats").Range("F" & jj).Value = mentR
'Unload oXMLFile(XMLFileName)
End Sub
Sub getEditionFind()
Dim zz As Integer, yy As Integer, xx As Integer
Dim fullClefTitreOr, fullClefTitreDup, clefTitreOr, clefTitreDup, clefMot As Variant, clefMotCount As Integer
Dim clefPPNor, clefPPNdup, clefPPN As Variant, clefPPNCount As Integer
Dim tableMatch(99, 3), tableCount As Integer, output As String
Dim catClefTitre As Integer, percMin As Integer, matchEffCul As Integer, matchNb As Integer, skipPerc As Boolean
mainWorkBook.Sheets("Résultats").Activate
For zz = 2 To rowIndex
If Range("B" & zz).Value <> "" Then
tableCount = 0
'catClefTitre = CInt(Left(Range("E" & zz).Value, 1))
fullClefTitreOr = Split(Range("D" & zz).Value, Chr(10))
For Each clefTitreOr In fullClefTitreOr
clefTitreOr = Split(clefTitreOr, "_")
For yy = 2 To rowIndex
'Check la clef du titre
fullClefTitreDup = Split(Range("D" & yy).Value, Chr(10))
For Each clefTitreDup In fullClefTitreDup
clefTitreDup = Split(clefTitreDup, "_")
clefMotCount = 0
matchEffCul = 0
skipPerc = False
'comment ej fais s ke dup est plus long
If UBound(clefTitreOr) <= UBound(clefTitreDup) Then
For Each clefMot In clefTitreOr
If Left(clefMot, 4) = Left(clefTitreDup(clefMotCount), 4) And Right(clefMot, 4) = Right(clefTitreDup(clefMotCount), 4) Then
matchEffCul = matchEffCul + 4
ElseIf Left(clefMot, 4) = Left(clefTitreDup(clefMotCount), 4) Or Right(clefMot, 4) = Right(clefTitreDup(clefMotCount), 4) Then
matchEffCul = matchEffCul + 3
End If
clefMotCount = clefMotCount + 1
Next
Else
For Each clefMot In clefTitreDup
If Left(clefMot, 4) = Left(clefTitreOr(clefMotCount), 4) And Right(clefMot, 4) = Right(clefTitreOr(clefMotCount), 4) Then
matchEffCul = matchEffCul + 4
ElseIf Left(clefMot, 4) = Left(clefTitreOr(clefMotCount), 4) Or Right(clefMot, 4) = Right(clefTitreOr(clefMotCount), 4) Then
matchEffCul = matchEffCul + 3
End If
clefMotCount = clefMotCount + 1
Next
End If
matchNb = matchEffCul / ((UBound(clefTitreOr) + 1) * 2 + (UBound(clefTitreDup) + 1) * 2) * 100
If matchEffCul = clefMotCount * 4 Then
skipPerc = True
End If
percMin = 80
'Select Case catClefTitre
' Case 1
' percMin = 66
' Case 2
' percMin = 70
' Case 3
' percMin = 75
' Case 4
' percMin = 80
'End Select
'Si ya match, il va regarder les auteurs
If (matchNb >= percMin Or skipPerc = True) And Range("A" & zz).Value <> Range("A" & yy).Value And Range("A" & yy).Value <> "" Then
tableMatch(tableCount, 0) = Range("A" & yy).Value
tableMatch(tableCount, 1) = matchNb
tableMatch(tableCount, 2) = 0
tableMatch(tableCount, 3) = 0
clefPPNor = Split(Range("F" & zz).Value, Chr(10))
clefPPNdup = Split(Range("F" & yy).Value, Chr(10))
For Each clefPPN In clefPPNor
For xx = 0 To UBound(clefPPNdup)
If clefPPN = clefPPNdup(xx) Then
tableMatch(tableCount, 3) = tableMatch(tableCount, 3) + 2
If Left(clefPPN, 1) <> "C" Then
tableMatch(tableCount, 2) = tableMatch(tableCount, 2) + 2
End If
End If
Next
Next
If UBound(clefPPNor) + UBound(clefPPNdup) + 2 >= 0 Then
tableMatch(tableCount, 2) = CInt(tableMatch(tableCount, 2) / (UBound(clefPPNor) + UBound(clefPPNdup) + 2) * 100)
tableMatch(tableCount, 3) = CInt(tableMatch(tableCount, 3) / (UBound(clefPPNor) + UBound(clefPPNdup) + 2) * 100)
Else
tableMatch(tableCount, 2) = "Ø"
tableMatch(tableCount, 3) = "Ø"
End If
tableCount = tableCount + 1
End If
Next
Next
Next
If tableCount > 0 Then
output = "Double éd. possible :"
For yy = 0 To tableCount - 1
output = appendNote(output, tableMatch(yy, 0) & " : " & tableMatch(yy, 1) & "%, " & tableMatch(yy, 2) & "%, " & tableMatch(yy, 3) & "%")
If tableMatch(yy, 2) > 0 Then
mainWorkBook.Sheets("Résultats").Range("A" & zz & ":G" & zz).Interior.Color = RGB(255, 0, 0)
ElseIf tableMatch(yy, 3) + 1 > tableMatch(yy, 2) And _
mainWorkBook.Sheets("Résultats").Range("A" & zz & ":G" & zz).Interior.Color <> RGB(255, 0, 0) Then
mainWorkBook.Sheets("Résultats").Range("A" & zz & ":G" & zz).Interior.Color = RGB(255, 192, 0)
ElseIf mainWorkBook.Sheets("Résultats").Range("A" & zz & ":G" & zz).Interior.Color <> RGB(255, 0, 0) And _
mainWorkBook.Sheets("Résultats").Range("A" & zz & ":G" & zz).Interior.Color <> RGB(255, 192, 0) Then
mainWorkBook.Sheets("Résultats").Range("A" & zz & ":G" & zz).Interior.Color = RGB(0, 176, 240)
End If
Next
Else
output = "Aucune détection automatique"
mainWorkBook.Sheets("Résultats").Range("A" & zz & ":G" & zz).Interior.Color = RGB(146, 208, 80)
End If
Range("G" & zz) = output
End If
Next
End Sub
Function appendNote(var As String, text As String)
If var = "" Then
var = text
Else
var = var & Chr(10) & text