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
| Sub NoteAct()
'Application.ScreenUpdating = False
Dim ech(480) As Single
Dim ech2(30) As Single
Dim ech3(30) As Single
Dim ech4(30) As Single
Dim stech(480) As String
Dim ech_ass(480) As Single
Dim ech_ass2(40) As Single
Dim ech_ass3(40) As Single
Dim ech_ass4(40) As Single
Dim ech_ass5(480) As Single
Dim ech_ass6(480) As Single
Dim stech_ass(480) As String
Dim stech_ass5(480) As String
Dim stech_ass6(480) As String
Dim assh_f(2, 2) As Single
Dim ass(480) As Single
Dim ass2(40) As Single
Dim ass3(40) As Single
Dim ass4(40) As Single
Dim stass(480) As String
Dim ass_h_f(2, 4) As Single
Dim ech_fam(480) As Single
Dim ech_fam2(40) As Single
Dim ech_fam3(40) As Single
Dim ech_fam4(40) As Single
Dim stech_fam(480) As String
capitall = Range("F2")
Dim capital(4) As String
Dim incidence(8, 4) As String
Dim decimale(2) As Single
Dim ech_ass_echass(40) As String
famm = Range("H4")
famp = Range("I4")
j = 0
If famm > 0 Then
j = famp
End If
For i = 1 To j
ech(i) = Range("D" & 2 + i)
ech_ass(i) = Range("D" & 2 + i) + Range("E" & 2 + i) - famm
ass(i) = Range("E" & 2 + i) - famm
ech_fam(i) = Range("D" & 2 + i) + Range("E" & 2 + i)
Next
For i = j + 1 To 480
ech(i) = Range("D" & 2 + i)
ech_ass(i) = Range("D" & 2 + i) + Range("E" & 2 + i)
ass(i) = Range("E" & 2 + i)
ech_fam(i) = Range("D" & 2 + i) + Range("E" & 2 + i)
Next
For i = 1 To 2
ass_h_f(i, 1) = Range("H" & 23 + i)
ass_h_f(i, 2) = Range("I" & 23 + i)
ass_h_f(i, 3) = Range("O" & 23 + i)
ass_h_f(i, 4) = Range("F" & 2 + i)
Next
h = 1
j = 1
l = 1
m = 1
ech2(1) = h
ech3(1) = h
ech_ass2(1) = j
ech_ass3(1) = j
ech_ass5(1) = ass_h_f(1, 1) * ass_h_f(1, 2) * capitall / 12
ech_ass6(1) = ass_h_f(2, 1) * ass_h_f(2, 2) * capitall / 12
ass2(1) = m
ass3(1) = m
ech_fam2(1) = h
ech_fam3(1) = h
cpt = 0
For i = 1 To 479
cpt = cpt + 1
If ech(i + 1) <> ech(i) Then
h = h + 1
ech(h) = ech(i + 1)
ech4(h - 1) = cpt
ech3(h) = cpt + 1
ech2(h - 1) = ech4(h - 1) - ech3(h - 1) + 1
End If
If ass(i + 1) <> ass(i) Then
m = m + 1
ass(m) = ass(i + 1)
ass4(m - 1) = cpt
ass3(m) = cpt + 1
ass2(m - 1) = ass4(m - 1) - ass3(m - 1) + 1
End If
If ech_ass(i + 1) <> ech_ass(i) Then
j = j + 1
ech_ass(j) = ech_ass(i + 1)
ech_ass4(j - 1) = cpt
ech_ass3(j) = cpt + 1
ech_ass2(j - 1) = ech_ass4(j - 1) - ech_ass3(j - 1) + 1
If ass_h_f(1, 3) >= ech_ass4(j - 1) Then
ech_ass5(j - 1) = ass_h_f(1, 1) * ass_h_f(1, 2) * capitall / 12
Else: ech_ass5(j - 1) = 0
End If
If ass_h_f(2, 3) >= ech_ass4(j - 1) Then
ech_ass6(j - 1) = ass_h_f(2, 1) * ass_h_f(2, 2) * capitall / 12
Else: ech_ass6(j - 1) = 0
End If
End If
If ech_fam(i + 1) <> ech_fam(i) Then
l = l + 1
ech_fam(l) = ech_fam(i + 1)
ech_fam4(l - 1) = cpt
ech_fam3(l) = cpt + 1
ech_fam2(l - 1) = ech_fam4(l - 1) - ech_fam3(l - 1) + 1
End If
Next
For i = j + 1 To 480
ech_ass(i) = 0
Next
For i = m + 1 To 480
ass(i) = 0
Next
For i = h + 1 To 480
ech(i) = 0
Next
For i = l + 1 To 480
ech_fam(i) = 0
Next
'For i = 1 To 480
' If ech_ass(i) > 0 Then
' Range("F" & 28 + i) = ech_ass(i)
' Range("G" & 28 + i) = ech_ass2(i)
' Range("H" & 28 + i) = ech_ass3(i)
' Range("I" & 28 + i) = ech_ass4(i)
' Range("J" & 28 + i) = ech_ass5(i)
' Range("J" & 28 + i) = ech_ass6(i)
' End If
'Next
Dim stdossier As String
dossier = Range("i1")
If dossier >= 1000 Then
stdossier = Format(dossier, "#"".""##0.00")
Else: stdossier = Format(dossier, "##0.00")
End If
Dim stgarantie As String
garantie = Range("l1")
If garantie >= 1000 Then
stgarantie = Format(garantie, "###"".""##0.00")
Else: stgarantie = Format(garantie, "##0.00")
End If
Dim stcourtage As String
courtage = Range("m1")
If courtage >= 1000 Then
stcourtage = Format(courtage, "###"".""##0.00")
Else: stcourtage = Format(courtage, "##0.00")
End If
Dim stcontrole As String
controle = Range("n1")
If controle >= 1000 Then
stcontrole = Format(controle, "###"".""##0.00")
Else: stcontrole = Format(controle, "##0.00")
End If
Dim duree As String
nb_ech = 1
While ech(nb_ech) <> 0
nb_ech = nb_ech + 1
Range("f29") = nb_ech
Wend
nb_ech_ass = 1
While ech_ass(nb_ech_ass) <> 0
nb_ech_ass = nb_ech_ass + 1
Range("f30") = nb_ech_ass
Wend
nb_ech_fam = 1
While ech_fam(nb_ech_fam) <> 0
nb_ech_fam = nb_ech_fam + 1
Range("f31") = nb_ech_fam
Wend
If ech4(nb_ech - 1) Mod 12 = 0 Then
duree = ech4(nb_ech - 1) & " ans"
Else: duree = ech4(nb_ech - 1) & " ans et " & ech4(nb_ech - 1) Mod 12 & " mois"
End If
For i = 1 To 4
If Range("J" & 4 + i) >= 1000000 Then
capital(i) = Format(Range("J" & 4 + i), "###"".""###"".""##0.00")
Else: capital(i) = Format(Range("J" & 4 + i), "###"".""##0.00")
End If
Next
For i = 1 To 8
For j = 1 To 2
incidence(i, j) = Format(Cells(12 + i, 10 + j) * 100, "0.000")
Next
For j = 3 To 4
incidence(i, j) = Format(Cells(12 + i, 10 + j) * 100, "0.00")
Next
Next
For i = 1 To 2
decimale(i) = Range("N" & 7 + i)
Next
For i = 1 To 2
For j = 1 To 2
assh_f(i, j) = Cells(23 + i, 7 + j)
Next
Next
For i = 1 To 480
If ech(i) >= 1000 Then
stech(i) = Format(ech(i), "#"".""##0.00")
Else: stech(i) = Format(ech(i), "##0.00")
End If
Range("F" & 27 + i) = stech(i)
If ech_ass(i) >= 1000 Then
stech_ass(i) = Format(ech_ass(i), "#"".""##0.00")
Else: stech_ass(i) = Format(ech_ass(i), "##0.00")
End If
Range("G" & 27 + i) = stech_ass(i)
If ech_ass5(i) >= 1000 Then
stech_ass5(i) = Format(ech_ass5(i), "#"".""##0.00")
Else: stech_ass5(i) = Format(ech_ass5(i), "##0.00")
End If
Range("F" & 27 + i) = ech_ass5(i)
If ech_ass6(i) >= 1000 Then
stech_ass6(i) = Format(ech_ass6(i), "#"".""##0.00")
Else: stech_ass6(i) = Format(ech_ass6(i), "##0.00")
End If
Range("G" & 27 + i) = ech_ass6(i)
If ass(i) >= 1000 Then
stass(i) = Format(ass(i), "#"".""##0.00")
Else: stass(i) = Format(ass(i), "##0.00")
End If
Range("H" & 27 + i) = stass(i)
If ech_fam(i) >= 1000 Then
stech_fam(i) = Format(ech_fam(i), "#"".""##0.00")
Else: stech_fam(i) = Format(ech_fam(i), "##0.00")
End If
Range("I" & 27 + i) = stech_fam(i)
Next
feuille_actuelle = ActiveSheet.Name
Dim Note As Object
Set Note = New Word.Application
'Set Note = Nothing
Note.WindowState = wdWindowStateMaximize
Note.Visible = True
'Note.Application.ScreenUpdating = False
Note.Documents.Open Filename:="Q:\Documents\modele_initial3.docx"
'Note.ActiveDocument.SaveAs Filename:="Q:\Documents\dossier_teg\" & feuille_actuelle & ".doc"
nbelement = 1
nbb = 2
Dim taux As Single
taux = Range("F6")
If famm = 0 Then
Note.Selection.MoveUp Unit:=wdLine, Count:=600
Note.Selection.Find.Text = "Assistance Famille Plus"
Note.Selection.Find.Forward = True
Note.Selection.Find.Execute
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=1
Note.Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
Note.Selection.TypeBackspace
Note.Selection.Find.Text = "La cotisation mensuelle d'Assistance Famille Plus s'élève à"
Note.Selection.Find.Forward = True
Note.Selection.Find.Execute
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=1
Note.Selection.MoveUp Unit:=wdLine, Count:=3
Note.Selection.MoveDown Unit:=wdLine, Count:=40, Extend:=wdExtend
Note.Selection.TypeBackspace
Note.Selection.Find.Text = "Assistance Famille Plus"
Note.Selection.Find.Forward = True
Note.Selection.Find.Execute
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=1
Note.Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
Note.Selection.TypeBackspace
End If
If ass_h_f(1, 1) = 0 And ass_h_f(2, 1) = 0 Then
Note.Selection.MoveUp Unit:=wdLine, Count:=600
Note.Selection.Find.Text = "Assurance Décès Invalidité - Perte totale et Irréversible d'Autonomie"
Note.Selection.Find.Forward = True
Note.Selection.Find.Execute
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=1
Note.Selection.MoveDown Unit:=wdLine, Count:=7, Extend:=wdExtend
Note.Selection.TypeBackspace
Note.Selection.Find.Text = "Le montant des cotisations d'assurance DI-PTIA s'élève à"
Note.Selection.Find.Forward = True
Note.Selection.Find.Execute
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=1
Note.Selection.MoveUp Unit:=wdLine, Count:=2
Note.Selection.MoveDown Unit:=wdLine, Count:=37, Extend:=wdExtend
Note.Selection.TypeBackspace
Note.Selection.Find.Text = "Assurance Emprunteur"
Note.Selection.Find.Forward = True
Note.Selection.Find.Execute
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=1
Note.Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
Note.Selection.TypeBackspace
End If
If controle = 0 Then
Note.Selection.MoveUp Unit:=wdLine, Count:=600
Note.Selection.Find.Text = "Frais de contrôle d'avancement de travaux"
Note.Selection.Find.Forward = True
Note.Selection.Find.Execute
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=1
Note.Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
Note.Selection.TypeBackspace
Note.Selection.Find.Text = "Les frais de contrôle d'avancement de travaux sont égaux"
Note.Selection.Find.Forward = True
Note.Selection.Find.Execute
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=1
Note.Selection.MoveUp Unit:=wdLine, Count:=2
Note.Selection.MoveDown Unit:=wdLine, Count:=30, Extend:=wdExtend
Note.Selection.TypeBackspace
Note.Selection.Find.Text = "Frais de contrôle d'avancement"
Note.Selection.Find.Forward = True
Note.Selection.Find.Execute
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=1
Note.Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
Note.Selection.TypeBackspace
Else: nbelement = nbelement + 1
End If
If courtage = 0 Then
Note.Selection.MoveUp Unit:=wdLine, Count:=600
Note.Selection.Find.Text = "Frais de courtage"
Note.Selection.Find.Forward = True
Note.Selection.Find.Execute
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=1
Note.Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
Note.Selection.TypeBackspace
Note.Selection.Find.Text = "Les frais de courtage sont égaux"
Note.Selection.Find.Forward = True
Note.Selection.Find.Execute
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=1
Note.Selection.MoveUp Unit:=wdLine, Count:=2
Note.Selection.MoveDown Unit:=wdLine, Count:=29, Extend:=wdExtend
Note.Selection.TypeBackspace
Note.Selection.Find.Text = "Frais de courtage"
Note.Selection.Find.Forward = True
Note.Selection.Find.Execute
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=1
Note.Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
Note.Selection.TypeBackspace
Else: nbelement = nbelement + 1
End If
If garantie = 0 Then
Note.Selection.MoveUp Unit:=wdLine, Count:=600
Note.Selection.Find.Text = "Frais de garantie hypothécaire"
Note.Selection.Find.Forward = True
Note.Selection.Find.Execute
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=1
Note.Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
Note.Selection.TypeBackspace
Note.Selection.Find.Text = "Les frais de garantie hypothécaire sont égaux"
Note.Selection.Find.Forward = True
Note.Selection.Find.Execute
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=1
Note.Selection.MoveUp Unit:=wdLine, Count:=1
Note.Selection.MoveDown Unit:=wdLine, Count:=27, Extend:=wdExtend
Note.Selection.TypeBackspace
Note.Selection.Find.Text = "Frais de garantie "
Note.Selection.Find.Forward = True
Note.Selection.Find.Execute
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=1
Note.Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
Note.Selection.TypeBackspace
Else: nbelement = nbelement + 1
End If
If dossier = 0 Then
Note.Selection.MoveUp Unit:=wdLine, Count:=600
Note.Selection.Find.Text = "Frais de dossier"
Note.Selection.Find.Forward = True
Note.Selection.Find.Execute
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=1
Note.Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
Note.Selection.TypeBackspace
Note.Selection.Find.Text = "Les frais de dossier sont égaux"
Note.Selection.Find.Forward = True
Note.Selection.Find.Execute
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=1
Note.Selection.MoveUp Unit:=wdLine, Count:=1
Note.Selection.MoveDown Unit:=wdLine, Count:=26, Extend:=wdExtend
Note.Selection.TypeBackspace
Note.Selection.Find.Text = "Frais de dossier"
Note.Selection.Find.Forward = True
Note.Selection.Find.Execute
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=1
Note.Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
Note.Selection.TypeBackspace
Note.Selection.Find
Note.Selection.Find.Text = " de dossier"
Note.Selection.Find.Replacement.Text = ""
Note.Selection.Find.Forward = True
Note.Selection.Find.MatchCase = True
Note.Selection.Find.MatchWholeWord = True
Note.Selection.Find.Execute Replace:=wdReplaceAll
Note.Selection.MoveUp Unit:=wdLine, Count:=600
Note.Selection.Find
Note.Selection.Find.Text = "fraisdossier+"
Note.Selection.Find.Replacement.Text = ""
Note.Selection.Find.Forward = True
Note.Selection.Find.MatchCase = True
Note.Selection.Find.MatchWholeWord = True
Note.Selection.Find.Execute Replace:=wdReplaceAll
Else:
nbelement = nbelement + 1
nbb = nbb + 1
Note.Selection.MoveUp Unit:=wdLine, Count:=600
Note.Selection.Find.Text = "XXXX"
Note.Selection.Find.Replacement.Text = nbb
Note.Selection.Find.Forward = True
Note.Selection.Find.MatchCase = True
Note.Selection.Find.MatchWholeWord = True
Note.Selection.Find.Execute Replace:=wdReplaceOne
End If
Note.Selection.MoveUp Unit:=wdLine, Count:=1
If garantie = 0 Then
Note.Selection.MoveUp Unit:=wdLine, Count:=600
Note.Selection.Find.Text = ", de garantie hypothécaire"
Note.Selection.Find.Replacement.Text = ""
Note.Selection.Find.Forward = True
Note.Selection.Find.MatchCase = True
Note.Selection.Find.MatchWholeWord = True
Note.Selection.Find.Execute Replace:=wdReplaceAll
Note.Selection.MoveUp Unit:=wdLine, Count:=600
Note.Selection.Find.Text = "fraisgarantie+"
Note.Selection.Find.Replacement.Text = ""
Note.Selection.Find.Forward = True
Note.Selection.Find.MatchCase = True
Note.Selection.Find.MatchWholeWord = True
Note.Selection.Find.Execute Replace:=wdReplaceAll
Else:
nbb = nbb + 1
Note.Selection.Find.Text = "XXXX"
Note.Selection.Find.Replacement.Text = nbb
Note.Selection.Find.Forward = True
Note.Selection.Find.MatchCase = True
Note.Selection.Find.MatchWholeWord = True
Note.Selection.Find.Execute Replace:=wdReplaceOne
End If
Note.Selection.MoveUp Unit:=wdLine, Count:=1
If courtage = 0 Then
Note.Selection.MoveUp Unit:=wdLine, Count:=600
With Note.Selection.Find
.Text = ", de courtage"
.Replacement.Text = ""
.Forward = True
.MatchCase = True
.MatchWholeWord = True
End With
Note.Selection.Find.Execute Replace:=wdReplaceAll
Note.Selection.MoveUp Unit:=wdLine, Count:=600
With Note.Selection.Find
.Text = "fraiscourtage+"
.Replacement.Text = ""
.Forward = True
.MatchCase = True
.MatchWholeWord = True
End With
Note.Selection.Find.Execute Replace:=wdReplaceAll
Else
nbb = nbb + 1
Note.Selection.Find.Text = "XXXX"
Note.Selection.Find.Replacement.Text = nbb
Note.Selection.Find.Forward = True
Note.Selection.Find.MatchCase = True
Note.Selection.Find.MatchWholeWord = True
Note.Selection.Find.Execute Replace:=wdReplaceOne
End If
Note.Selection.MoveUp Unit:=wdLine, Count:=1
If controle = 0 Then
Note.Selection.MoveUp Unit:=wdLine, Count:=600
With Note.Selection.Find
.Text = ", de contrôle d'avancement de travaux"
.Replacement.Text = ""
.Forward = True
.MatchCase = True
.MatchWholeWord = True
End With
Note.Selection.Find.Execute Replace:=wdReplaceAll
Note.Selection.MoveUp Unit:=wdLine, Count:=600
With Note.Selection.Find
.Text = "fraiscontrole+"
.Replacement.Text = ""
.Forward = True
.MatchCase = True
.MatchWholeWord = True
End With
Note.Selection.Find.Execute Replace:=wdReplaceAll
Else
nbb = nbb + 1
Note.Selection.Find.Text = "XXXX"
Note.Selection.Find.Replacement.Text = nbb
Note.Selection.Find.Forward = True
Note.Selection.Find.MatchCase = True
Note.Selection.Find.MatchWholeWord = True
Note.Selection.Find.Execute Replace:=wdReplaceOne
End If
Note.Selection.MoveUp Unit:=wdLine, Count:=1
If ass_h_f(1, 1) > 0 Or ass_h_f(2, 1) > 0 Then
nbb = nbb + 1
Note.Selection.Find.Text = "XXXX"
Note.Selection.Find.Replacement.Text = nbb
Note.Selection.Find.Forward = True
Note.Selection.Find.MatchCase = True
Note.Selection.Find.MatchWholeWord = True
Note.Selection.Find.Execute Replace:=wdReplaceOne
Note.Selection.MoveRight Unit:=wdCharacter, Count:=1
End If
If famm > 0 Then
nbb = nbb + 1
Note.Selection.Find.Text = "XXXX"
Note.Selection.Find.Replacement.Text = nbb
Note.Selection.Find.Forward = True
Note.Selection.Find.MatchCase = True
Note.Selection.Find.MatchWholeWord = True
Note.Selection.Find.Execute Replace:=wdReplaceOne
End If
Note.Selection.MoveUp Unit:=wdLine, Count:=600
With Note.Selection.Find
.Text = "des frais,"
.Replacement.Text = "des frais"
.Forward = True
.MatchCase = True
.MatchWholeWord = True
End With
Note.Selection.Find.Execute Replace:=wdReplaceAll
Note.Selection.MoveUp Unit:=wdLine, Count:=600
With Note.Selection.Find
.Text = "des frais et"
.Replacement.Text = "des frais"
.Forward = True
.MatchCase = True
.MatchWholeWord = True
End With
Note.Selection.Find.Execute Replace:=wdReplaceAll
i = 0
If (nb_ech - 1) Mod 2 = 0 Then
i = 1
End If
j = 0
If (nb_ech_ass - 1) Mod 2 = 0 Then
j = 1
End If
k = 0
If (nb_ech_fam - 1) Mod 2 = 0 Then
k = 1
End If
Note.Selection.MoveUp Unit:=wdLine, Count:=600
With Note.Selection.Find
.Text = "ech" & nb_ech
.Forward = True
.MatchCase = True
.MatchWholeWord = True
End With
Note.Selection.Find.Execute
For j = 1 To nbelement
Note.Selection.Find.Execute
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=3
Note.Selection.MoveRight Unit:=wdCharacter, Count:=i * 7, Extend:=wdExtend
Note.Selection.MoveRight Unit:=wdCharacter, Count:=(30 - nb_ech) / 2 * 13, Extend:=wdExtend
Note.Selection.MoveRight Unit:=wdCharacter, Count:=(1 - i) * 7 - 1, Extend:=wdExtend
Note.Selection.TypeBackspace
Next
If ass_h_f(1, 1) > 0 Or ass_h_f(1, 1) > 0 Then
With Note.Selection.Find
.Text = "echadi" & nb_ech_ass
.Forward = True
.MatchCase = True
.MatchWholeWord = True
End With
Note.Selection.Find.Execute
Note.Selection.MoveRight Unit:=wdCharacter, Count:=9
Note.Selection.MoveDown Unit:=wdLine, Count:=30 - nb_ech_ass + 1, Extend:=wdExtend
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=3, Extend:=wdExtend
Note.Selection.Cells.Delete ShiftCells:=wdDeleteCellsShiftLeft
Note.Selection.Find.Execute
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=3
Note.Selection.MoveRight Unit:=wdCharacter, Count:=j * 7, Extend:=wdExtend
Note.Selection.MoveRight Unit:=wdCharacter, Count:=(30 - nb_ech_ass) / 2 * 13, Extend:=wdExtend
Note.Selection.MoveRight Unit:=wdCharacter, Count:=(1 - j) * 7 - (1 - j), Extend:=wdExtend
Note.Selection.TypeBackspace
End If
If famm > 0 Then
With Note.Selection.Find
.Text = "echfamplus" & nb_ech_fam
.Forward = True
.MatchCase = True
.MatchWholeWord = True
End With
Note.Selection.Find.Execute
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=3
Note.Selection.MoveRight Unit:=wdCharacter, Count:=k * 7, Extend:=wdExtend
Note.Selection.MoveRight Unit:=wdCharacter, Count:=(30 - nb_ech_fam) / 2 * 13, Extend:=wdExtend
Note.Selection.MoveRight Unit:=wdCharacter, Count:=(k - i) * 7 - 1, Extend:=wdExtend
Note.Selection.TypeBackspace
End If
Note.Selection.MoveUp Unit:=wdLine, Count:=600
With Note.Selection.Find
.Text = "ech" & nb_ech
.Forward = True
.MatchCase = True
.MatchWholeWord = True
End With
Note.Selection.Find.Execute
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=3
Note.Selection.MoveDown Unit:=wdLine, Count:=30 - nb_ech + 1, Extend:=wdExtend
Note.Selection.TypeBackspace
If ass_h_f(1, 1) > 0 Or ass_h_f(2, 1) > 0 Then
If ech(1) > 0 Then
For i = 1 To 2
Note.Selection.MoveUp Unit:=wdLine, Count:=600
With Note.Selection.Find
.Text = "montantpret2"
.Forward = True
.MatchCase = True
.MatchWholeWord = True
End With
Note.Selection.Find.Execute
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=4
Note.Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
Note.Selection.TypeBackspace
Next
End If
If ass_h_f(1, 1) = 0 Then
Note.Selection.MoveUp Unit:=wdLine, Count:=600
With Note.Selection.Find
.Text = "Monsieur : taux de cotisation"
.Forward = True
.MatchCase = True
.MatchWholeWord = True
End With
Note.Selection.Find.Execute
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=3
Note.Selection.MoveDown Unit:=wdLine, Count:=3
Note.Selection.TypeBackspace
With Note.Selection.Find
.Text = "Pour Monsieur :"
.Forward = True
.MatchCase = True
.MatchWholeWord = True
End With
Note.Selection.Find.Execute
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=1
Note.Selection.MoveDown Unit:=wdLine, Count:=3
Note.Selection.TypeBackspace
Else
Note.Selection.MoveUp Unit:=wdLine, Count:=600
With Note.Selection.Find
.Text = "Madame : taux de cotisation"
.Forward = True
.MatchCase = True
.MatchWholeWord = True
End With
Note.Selection.Find.Execute
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=3
Note.Selection.MoveDown Unit:=wdLine, Count:=3, Extend:=wdExtend
Note.Selection.TypeBackspace
With Note.Selection.Find
.Text = "Pour Madame :"
.Forward = True
.MatchCase = True
.MatchWholeWord = True
End With
Note.Selection.Find.Execute
Note.Selection.MoveLeft Unit:=wdCharacter, Count:=1
Note.Selection.MoveDown Unit:=wdLine, Count:=3, Extend:=wdExtend
Note.Selection.TypeBackspace
End If
Note.Selection.MoveUp Unit:=wdLine, Count:=600
End If
Note.Content.Find.Execute Findtext:="montantpret", replacewith:=capital(1), Replace:=wdReplaceAll
' .Text = "montantpret"
' .Replacemement.Text = capital(1)
' .Forward = True
' End With
'Note.Selection.Find.Execute Replace:=wdReplaceAll
Note.Selection.MoveUp Unit:=wdLine, Count:=600
With Note.Selection.Find
.Text = "tauxpret"
.Replacemement.Text = taux
.Forward = True
.MatchCase = True
.MatchWholeWord = True
End With
Note.Selection.Find.Execute Replace:=wdReplaceAll
Note.Selection.MoveUp Unit:=wdLine, Count:=600
With Note.Selection.Find
.Text = "annee"
.Replacemement.Text = duree
.Forward = True
.MatchCase = True
.MatchWholeWord = True
End With
Note.Selection.Find.Execute Replace:=wdReplaceAll
Note.Selection.MoveUp Unit:=wdLine, Count:=600
With Note.Selection.Find
.Text = "nbech"
.Replacemement.Text = ech4(nb_ech - 1)
.Forward = True
.MatchCase = True
.MatchWholeWord = True
End With
Note.Selection.Find.Execute Replace:=wdReplaceAll
Note.Selection.MoveUp Unit:=wdLine, Count:=600
With Note.Selection.Find
.Text = "fraisdossier"
.Replacemement.Text = stdossier
.Forward = True
.MatchCase = True
.MatchWholeWord = True
End With
Note.Selection.Find.Execute Replace:=wdReplaceAll
Note.Selection.MoveUp Unit:=wdLine, Count:=600
With Note.Selection.Find
.Text = "fraisgarantie"
.Replacemement.Text = stgarantie
.Forward = True
.MatchCase = True
.MatchWholeWord = True
End With
Note.Selection.Find.Execute Replace:=wdReplaceAll
Note.Selection.MoveUp Unit:=wdLine, Count:=600
With Note.Selection.Find
.Text = "fraiscourtage"
.Replacemement.Text = stcourtage
.Forward = True
.MatchCase = True
.MatchWholeWord = True
End With
Note.Selection.Find.Execute Replace:=wdReplaceAll
Note.Selection.MoveUp Unit:=wdLine, Count:=600
With Note.Selection.Find
.Text = "fraiscontrole"
.Replacemement.Text = stcontrole
.Forward = True
.MatchCase = True
.MatchWholeWord = True
End With
Note.Selection.Find.Execute Replace:=wdReplaceAll
Note.Selection.MoveUp Unit:=wdLine, Count:=600
With Note.Selection.Find
.Text = "primeadih"
.Replacemement.Text = Format(ass_h_f(1, 2) * 100, "0.000")
.Forward = True
.MatchCase = True
.MatchWholeWord = True
End With
Note.Selection.Find.Execute Replace:=wdReplaceAll
Note.Selection.MoveUp Unit:=wdLine, Count:=600
With Note.Selection.Find
.Text = "primeadif"
.Replacemement.Text = Format(ass_h_f(2, 2) * 100, "0.000")
.Forward = True
.MatchCase = True
.MatchWholeWord = True
End With
Note.Selection.Find.Execute Replace:=wdReplaceAll
Note.Selection.MoveUp Unit:=wdLine, Count:=600
With Note.Selection.Find
.Text = "adih"
.Replacemement.Text = Format(ass_h_f(1, 1) * 100, "0.000")
.Forward = True
.MatchCase = True
.MatchWholeWord = True
End With
Note.Selection.Find.Execute Replace:=wdReplaceAll
Note.Selection.MoveUp Unit:=wdLine, Count:=600
With Note.Selection.Find
.Text = "adif"
.Replacemement.Text = Format(ass_h_f(2, 1) * 100, "0.000")
.Forward = True
.MatchCase = True
.MatchWholeWord = True
End With
Note.Selection.Find.Execute Replace:=wdReplaceAll
Note.Selection.MoveUp Unit:=wdLine, Count:=600
For i = 1 To nb_ech - 1
With Note.Selection.Find
.Text = "ech" & i
.Replacemement.Text = stech(i)
.Forward = True
.MatchCase = True
.MatchWholeWord = True
End With
Note.Selection.Find.Execute Replace:=wdReplaceAll
Note.Selection.MoveUp Unit:=wdLine, Count:=600
Next
Note.Application.ScreenUpdating = True
Application.ScreenUpdating = True
End Sub |
Partager