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
|
Dim lig As Integer, modif As Integer, renouvx As Integer, NDF As String, NDF2 As String, DNSS As String
Private Sub BOUTONCREATION_Click()
' on va créer ou modifier une fiche
If MsgBox("Avez-vous rempli tous les champs spécifiques à votre service ?", vbQuestion + vbYesNo, "ATTENTION") = vbYes Then
' LA REPONSE EST "OUI"
' CHAMPS OBLIGATOIRES REMPLIS ?
If Me.NOM.Text = "" Then
MsgBox "Vous devez entrer un nom."
Me.NOM.SetFocus
Exit Sub
End If
If Me.PRENOM.Text = "" Then
MsgBox "Vous devez entrer un prénom."
Me.PRENOM.SetFocus
Exit Sub
End If
If Me.civil.Text = "" Then
MsgBox "Oubli de civilité"
Me.civil.SetFocus
Exit Sub
End If
If Me.JOURNSS.Text = "" Then
MsgBox "Date de naissance incomplète."
Me.JOURNSS.SetFocus
Exit Sub
End If
If Me.MOISNSS.Text = "" Then
MsgBox "Date de naissance incomplète."
Me.MOISNSS.SetFocus
Exit Sub
End If
If Me.ANNEENSS.Text = "" Then
MsgBox "Date de naissance incomplète."
Me.ANNEENSS.SetFocus
Exit Sub
End If
If Me.STATUT.Text = "" Then
MsgBox "Il faut un statut."
Me.STATUT.SetFocus
Exit Sub
End If
If Me.ADRESSE.Text = "" Then
MsgBox "Adresse incomplète."
Me.ADRESSE.SetFocus
Exit Sub
End If
If Me.COMMUNE.Text = "" Then
MsgBox "Commune de résidence non renseignée."
Me.COMMUNE.SetFocus
Exit Sub
End If
If Me.TELFIXE.Text = "" And Me.TELMOB = "" Then
MsgBox "Au moins un téléphone obligatoire."
Me.TELFIXE.SetFocus
Exit Sub
End If
If Me.LR.Value = False And Me.CSS.Value = False Then
MsgBox "Il faut choisir LR ou CSS"
Exit Sub
End If
If Me.numcarte.Text = "" Then
MsgBox "Numéro de carte non renseignée."
Me.numcarte.SetFocus
Exit Sub
End If
'ok tout est rempli on continue
' Conversion du nom et prénom en NOMPRPRE
Nomconverti = Application.WorksheetFunction.Proper(Me.NOM.Text)
prenomconverti = Application.WorksheetFunction.Proper(Me.PRENOM.Text)
' Selection derniere ligne du tableau si création ou de la ligne si modif
If modif = 0 Then
' c'est une nouvelle fiche
Sheets("BDD").Select
valeur = Range("B8").Value
If valeur = "" Then
Range("B8").Select
Else
Range("B7").Select
Selection.End(xlDown).Select
ligneactive = ActiveCell.Row
Range("B" & ligneactive + 1).Select
End If
ligneactive = ActiveCell.Row
' collage date de création dev la fiche et délivrance de la carte identiques puisque nouvelle fiche
Range("B" & ligneactive).Select
Selection.NumberFormat = "DD/MM/YYYY"
Range("B" & ligneactive).Value = Now
Range("q" & ligneactive).Select
Selection.NumberFormat = "DD/MM/YYYY"
Range("q" & ligneactive).Value = Now
Else
' sinon c'est une modif éventuelle, la ligne active est celle renvoyée par une des trois recherches
ligneactive = lig
End If
' Collage des donnees dans la BDD que ce soit création ou modification
secval = Val(secteur)
If secval = 0 Then secval = ""
Range("u" & ligneactive).Value = secval
Range("v" & ligneactive).Value = lot
Range("w" & ligneactive).Value = classe
Range("C" & ligneactive).Value = civil
Range("d" & ligneactive).Value = Nomconverti
Range("e" & ligneactive).Value = prenomconverti
Range("f" & ligneactive).Value = STATUT
DNSS = JOURNSS & "/" & MOISNSS & "/" & ANNEENSS
Range("g" & ligneactive).Value = DNSS
Range("h" & ligneactive).Value = TELFIXE
Range("i" & ligneactive).Value = TELMOB
Range("h" & ligneactive & ":i" & ligneactive).Select
Selection.NumberFormat = "0#"" ""##"" ""##"" ""##"" ""##"
Range("j" & ligneactive).Value = mel
Range("k" & ligneactive).Value = ADRESSE
Range("l" & ligneactive).Value = COMMUNE
Range("m" & ligneactive).Value = montee
Range("n" & ligneactive).Value = ets
Range("o" & ligneactive).Value = destiville
Range("p" & ligneactive).Value = numcarte
If renouv = True Then
'si on a coché la case renouv (ellement), on délivre un nouvelle carte donc on change seulement la date de délivrance
Range("q" & ligneactive).Select
Selection.NumberFormat = "DD/MM/YYYY"
Range("q" & ligneactive).Value = Now
'on compte le nombre de renouvellement
renouvx = renouvx + 1
End If
Range("r" & ligneactive).Value = renouvx
Range("s" & ligneactive).Value = Li1
Range("t" & ligneactive).Value = Li2
Range("u" & ligneactive).Value = Li3
Range("y" & ligneactive).Value = anneesco
'----------------------------------ouverture word------------------------------------------
' si c'est un renouvellement=choix courrier1, si c'est une création LR=choix courrier2 si c'est une création SP=courrier3
' si c'est aucun des trois, juste une modif de l'adresse ou autre, on imprime rien et on envoie rien
ADRESSE1 = CStr(ADRESSE)
COMMUNE1 = CStr(COMMUNE)
civil1 = CStr(civil)
createur1 = CStr(createur)
Dim WordApp As Word.Application
Dim WordDoc As Word.Document
NDF2 = "s:\tests\" & Nomconverti & " " & prenomconverti & ".doc"
On Error Resume Next
Set WordApp = CreateObject("Word.Application")
Set WordDoc = WordApp.Documents.Open(NDF, ReadOnly:=False)
With WordApp
.Visible = True
End With
With WordApp
.Selection.Goto what:=wdGoToBookmark, Name:="adresse"
.Selection.TypeText Text:=ADRESSE1
End With
With WordApp
.Selection.Goto what:=wdGoToBookmark, Name:="nomprenom"
.Selection.TypeText Text:=Nomconverti & " " & prenomconverti
End With
With WordApp
.Selection.Goto what:=wdGoToBookmark, Name:="commune"
.Selection.TypeText Text:=COMMUNE1
End With
With WordApp
.Selection.Goto what:=wdGoToBookmark, Name:="civilite"
.Selection.TypeText Text:=civil1
End With
With WordApp
.Selection.Goto what:=wdGoToBookmark, Name:="civilite2"
.Selection.TypeText Text:=civil1
End With
With WordApp
.Selection.Goto what:=wdGoToBookmark, Name:="civilite3"
.Selection.TypeText Text:=civil1
End With
With WordApp
.Selection.Goto what:=wdGoToBookmark, Name:="createur"
.Selection.TypeText Text:=createur1
End With
Dim ImprCour As String
Dim Impr2 As String
ImprCour = Application.ActivePrinter
MsgBox ImprCour
Impr2 = "\\srv-imp\MU132703 sur Ne04:"
Application.ActivePrinter = Impr2
MsgBox Application.ActivePrinter
'ActiveDocument.PrintOut
Application.ActivePrinter = ImprCour
'imprimer tout de suite ?
'scurrentprinter = ActivePrinter 'Save the current printer
'If MsgBox("Imprimer ?", vbQuestion + vbYesNo, "ATTENTION") = vbYes Then
'stray = Options.DefaultTray 'Save the current tray
'With WordApp
'ActivePrinter = "\\srv-imp\MU132703"
'Application.PrintOut Filename:="", Range:=wdPrintAllDocument, Item:= _
'wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, _
'ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:= _
'False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
'PrintZoomPaperHeight:=0
'End With
'ActivePrinter = scurrentprinter 'Restore the original printer
'Options.DefaultTray = stray 'Restore the original tray
'End If
WordDoc.Application.ActiveDocument.SaveAs NDF2
WordApp.Application.Quit
Set WordDoc = Nothing
Set WordApp = Nothing
'----------------------------------fermeture de word---------------------------------------------------
' mise en forme conditionnelle des données dans la BDD
Range("B" & ligneactive & ":y" & ligneactive).Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=MOD(LIGNE();2)"
Selection.FormatConditions(1).Interior.ColorIndex = 37
' mise en forme bordures
With Range("p" & ligneactive & ":y" & ligneactive)
.HorizontalAlignment = xlCenter
End With
With Range("g" & ligneactive & ":i" & ligneactive)
.HorizontalAlignment = xlCenter
End With
Range("b" & ligneactive & ":y" & ligneactive).Select
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
' On décharge le formulaire et on affiche le nombre de renouvellements si renouv cochée
If renouv = True Then MsgBox ("carte renouvellé" & renouvx & " fois")
Unload Me
Else
Exit Sub
End If
End Sub
Private Sub BOUTONRECHERCHER_Click()
' rechercher nom
Dim L1 As Integer, L2 As Integer, ltxt0 As Integer
Dim i As Integer, txt0 As String, txt1 As String
'effacer la listbox
ListBox1.Clear
'lire le champ nom
txt0 = NOM.Text
'longueur de la chaine à comparer
ltxt0 = Len(txt0)
If ltxt0 = 0 Then Exit Sub
Sheets("BDD").Select
'la dernière ligne du taleau
ActiveCell.SpecialCells(xlLastCell).Select
L2 = ActiveCell.Row
'revient en haut du tableau
Range("F8").Select
'les noms sont dans la colonne 3
For i = 8 To L2
txt1 = Cells(i, 4).Text
'comparer en majuscules avec le nom cherché
If UCase(Left(txt1, ltxt0)) = UCase(txt0) Then
txtprenom = Cells(i, 5).Text
txtdatenss = Cells(i, 7).Text
'si c'est bon on l'ajoute a la ListBox
'et en préfixe la valeur de la ligne ou il se trouve
ListBox1.AddItem (Str(i) & " : " & txt1 & " " & txtprenom & " " & txtdatenss)
End If
Next
'on regarde le contenu de ListBox
Select Case ListBox1.ListCount
Case 0 ' vide
MsgBox "Rien trouvé"
Case 1 ' un seul correspond
txt1 = ListBox1.List(0)
'recuperer la n° de la ligne ou se trouve le nom dans le tableau
i = Val(txt1)
lig = i
'lire les valeur de la ligne du taleau (Nom,Prenom...)
'si les champs secteur et lot sont remplis alors la case sp (css) est cochée
'sinon c'est la case LR
If Range("v" & lig).Value <> "" And Range("w" & lig).Value <> "" Then
Me.CSS.Value = True
Else: Me.LR.Value = True
End If
secteur = Range("v" & lig).Value
lot = Range("w" & lig).Value
classe = Range("x" & lig).Value
NOM = Range("d" & lig).Value
PRENOM = Range("e" & lig).Value
STATUT = Range("f" & lig).Value
varnss = Range("g" & lig).Value
civil = Range("C" & lig).Value
JOURNSS = Left(varnss, 2)
ANNEENSS = Right(varnss, 4)
MOISNSS = Mid(varnss, 4, 2)
TELFIXE = Range("h" & lig).Value
TELMOB = Range("i" & lig).Value
mel = Range("ij" & lig).Value
ADRESSE = Range("k" & lig).Value
COMMUNE = Range("l" & lig).Value
montee = Range("m" & lig).Value
ets = Range("n" & lig).Value
destiville = Range("o" & lig).Value
numcarte = Range("p" & lig).Value
renouvx = Range("r" & lig).Value
Li1 = Range("s" & lig).Value
Li2 = Range("t" & lig).Value
Li3 = Range("u" & lig).Value
anneesco = Range("y" & lig).Value
modif = 1
ligmodif = lig
Case Else 'sinon montre la listbox pour faire un choix
ListBox1.Visible = True
End Select
End Sub
Private Sub boutonquit_Click()
Sheets("creation").Select
Unload Me
End Sub
Private Sub CommandButton2_Click()
' recherche coupon
Dim L1 As Integer, L2 As Integer, ltxt0 As Integer
Dim i As Integer, txt0 As String, txt1 As String
ListBox2.Clear
txt0 = numcoupon.Text
ltxt0 = Len(txt0)
If ltxt0 = 0 Then Exit Sub
Sheets("BDD").Select
L1 = 8
ActiveCell.SpecialCells(xlLastCell).Select
L2 = ActiveCell.Row
Range("F8").Select
For i = L1 To L2
txt1 = Cells(i, 16).Text
If UCase(Left(txt1, ltxt0)) = UCase(txt0) Then
txtprenom = Cells(i, 5).Text
txtnom = Cells(i, 4).Text
txtdatenss = Cells(i, 6).Text
ListBox2.AddItem (Str(i) & " : " & txt1 & " " & txtprenom & " " & txtdatenss)
End If
Next
'on regarde le contenu de ListBox2
Select Case ListBox2.ListCount
Case 0 ' vide
MsgBox "Rien trouvé"
Case 1 ' un seul correspond
'lire l'enregistrement 0
txt1 = ListBox2.List(0)
'recuperer la n° de la ligne ou se trouve le nom dans le tableau
i = Val(txt1)
lig = i
'lire les valeur de la ligne du taleau (Nom,Prenom...)
If Range("v" & lig).Value <> "" And Range("w" & lig).Value <> "" Then
Me.CSS.Value = True
Else: Me.LR.Value = True
End If
secteur = Range("v" & lig).Value
lot = Range("w" & lig).Value
classe = Range("x" & lig).Value
civil = Range("C" & lig).Value
NOM = Range("d" & lig).Value
PRENOM = Range("e" & lig).Value
STATUT = Range("f" & lig).Value
varnss = Range("g" & lig).Value
JOURNSS = Left(varnss, 2)
ANNEENSS = Right(varnss, 4)
MOISNSS = Mid(varnss, 4, 2)
TELFIXE = Range("h" & lig).Value
TELMOB = Range("i" & lig).Value
mel = Range("j" & lig).Value
ADRESSE = Range("k" & lig).Value
COMMUNE = Range("l" & lig).Value
montee = Range("m" & lig).Value
ets = Range("n" & lig).Value
destiville = Range("o" & lig).Value
numcarte = Range("p" & lig).Value
renouvx = Range("r" & lig).Value
Li1 = Range("s" & lig).Value
Li2 = Range("t" & lig).Value
Li3 = Range("u" & lig).Value
anneesco = Range("y" & lig).Value
modif = 1
ligmodif = lig
Case Else 'sinom montre la listbox pour faire un choix
ListBox2.Visible = True
End Select
End Sub
Private Sub CommandButton3_Click()
' generer liste par recherche du secteur ou du lot
Dim i As Integer
Sheets("bdd").Select
ActiveCell.SpecialCells(xlLastCell).Select
L2 = ActiveCell.Row
Range("F8").Select
listsco.Clear
sec1 = Val(secteur)
lot1 = UCase(lot.Text)
If sec1 > 0 And lot1 = "" Then
lot.Value = ""
For i = 8 To L2
sec1 = Cells(i, 22).Value
If sec1 = Val(secteur) Then
lenom = Cells(i, 4).Value
leprenom = Cells(i, 5).Value
txtdatenss = Cells(i, 7).Value
lot1 = Cells(i, 23).Value
listsco.AddItem (Str(i) & " : Sect " & sec1 & " " & lot1 & " " & lenom & " " & leprenom & " " & txtdatenss)
End If
Next
secteur.Value = ""
ElseIf lot1 <> "" And sec1 = 0 Then
secteur.Value = ""
For i = 8 To L2
If lot1 = UCase(Cells(i, 23).Value) Then
sec1 = Cells(i, 22).Value
lenom = Cells(i, 4).Value
leprenom = Cells(i, 5).Value
txtdatenss = Cells(i, 7).Value
listsco.AddItem (Str(i) & " : Sect " & sec1 & " " & lot1 & " " & lenom & " " & leprenom & " " & txtdatenss)
End If
Next
lot.Value = ""
ElseIf lot1 = "" And sec1 = 0 Then
For i = 8 To L2
sec1 = Cells(i, 22).Value
lot1 = Cells(i, 23).Value
lenom = Cells(i, 4).Value
leprenom = Cells(i, 5).Value
txtdatenss = Cells(i, 7).Value
If Cells(i, 22).Value > 0 Then
listsco.AddItem (Str(i) & " : Sect " & sec1 & " " & lot1 & " " & lenom & " " & leprenom & " " & txtdatenss)
End If
Next
End If
End Sub
Private Sub CSS_Click()
NDF = "s:\tests\lettre circuits spéciaux sco.doc"
End Sub
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
'Choix pour Liste retournée par recherche d'un nom
Dim ind As Integer
Dim txt As String
'indice du choix
ind = ListBox1.ListIndex
txt = ListBox1.List(ind)
'recuperer la n° de la ligne ou se trouve le nom dans le tableau
lig = Val(txt)
'faire disparaire la listbox
ListBox1.Visible = False
'lire les valeur de la ligne du taleau (Nom,Prenom...)
If Range("v" & lig).Value <> "" And Range("w" & lig).Value <> "" Then
Me.CSS.Value = True
Else: Me.LR.Value = True
End If
secteur = Range("v" & lig).Value
lot = Range("w" & lig).Value
classe = Range("x" & lig).Value
civil = Range("C" & lig).Value
NOM = Range("d" & lig).Value
PRENOM = Range("e" & lig).Value
STATUT = Range("f" & lig).Value
varnss = Range("g" & lig).Value
JOURNSS = Left(varnss, 2)
ANNEENSS = Right(varnss, 4)
MOISNSS = Mid(varnss, 4, 2)
TELFIXE = Range("h" & lig).Value
TELMOB = Range("i" & lig).Value
mel = Range("j" & lig).Value
ADRESSE = Range("k" & lig).Value
COMMUNE = Range("l" & lig).Value
montee = Range("m" & lig).Value
ets = Range("n" & lig).Value
destiville = Range("o" & lig).Value
numcarte = Range("p" & lig).Value
renouvx = Range("r" & lig).Value
Li1 = Range("s" & lig).Value
Li2 = Range("t" & lig).Value
Li3 = Range("u" & lig).Value
anneesco = Range("y" & lig).Value
modif = 1
ligmodif = lig
End Sub
Private Sub ListBox2_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
' choix pour liste par recherche du numéro de carte
Dim ind As Integer
Dim txt As String
'indice du choix
ind = ListBox2.ListIndex
txt = ListBox2.List(ind)
'recuperer la n° de la ligne ou se trouve le nom dans le tableau
lig = Val(txt)
'faire disparaire la listbox
ListBox2.Visible = False
'lire les valeurs de la ligne du taleau (Nom,Prenom...)
If Range("v" & lig).Value <> "" And Range("w" & lig).Value <> "" Then
Me.CSS.Value = True
Else: Me.LR.Value = True
End If
secteur = Range("v" & lig).Value
lot = Range("w" & lig).Value
classe = Range("x" & lig).Value
civil = Range("C" & lig).Value
NOM = Range("d" & lig).Value
PRENOM = Range("e" & lig).Value
STATUT = Range("f" & lig).Value
varnss = Range("g" & lig).Value
JOURNSS = Left(varnss, 2)
ANNEENSS = Right(varnss, 4)
MOISNSS = Mid(varnss, 4, 2)
TELFIXE = Range("h" & lig).Value
TELMOB = Range("i" & lig).Value
mel = Range("j" & lig).Value
ADRESSE = Range("k" & lig).Value
COMMUNE = Range("l" & lig).Value
montee = Range("m" & lig).Value
ets = Range("n" & lig).Value
destiville = Range("o" & lig).Value
numcarte = Range("p" & lig).Value
renouvx = Range("r" & lig).Value
Li1 = Range("s" & lig).Value
Li2 = Range("t" & lig).Value
Li3 = Range("u" & lig).Value
anneesco = Range("y" & lig).Value
modif = 1
ligmodif = lig
End Sub
Private Sub listsco_dblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim ind As Integer
Dim txt As String
'indice du choix
ind = listsco.ListIndex
'texte choisi
txt = listsco.List(ind)
'recuperer la n° de la ligne ou se trouve le nom dans le tableau
lig = Val(txt)
'faire disparaire la listbox
ListBox1.Visible = False
'lire les valeur de la ligne du taleau (Nom,Prenom...)
'Range("B" & ligneactive).Select
'Selection.NumberFormat = "DD/MM/YYYY"
'Range("B" & i).Value = Now
If Range("v" & lig).Value <> "" And Range("w" & lig).Value <> "" Then
Me.CSS.Value = True
Else: Me.LR.Value = True
End If
secteur = Range("v" & lig).Value
lot = Range("w" & lig).Value
classe = Range("x" & lig).Value
civil = Range("C" & lig).Value
NOM = Range("d" & lig).Value
PRENOM = Range("e" & lig).Value
STATUT = Range("f" & lig).Value
varnss = Range("g" & lig).Value
JOURNSS = Left(varnss, 2)
ANNEENSS = Right(varnss, 4)
MOISNSS = Mid(varnss, 4, 2)
TELFIXE = Range("h" & lig).Value
TELMOB = Range("i" & lig).Value
mel = Range("j" & lig).Value
ADRESSE = Range("k" & lig).Value
COMMUNE = Range("l" & lig).Value
montee = Range("m" & lig).Value
ets = Range("n" & lig).Value
destiville = Range("o" & lig).Value
numcarte = Range("p" & lig).Value
renouvx = Range("r" & lig).Value
Li1 = Range("s" & lig).Value
Li2 = Range("t" & lig).Value
Li3 = Range("u" & lig).Value
anneesco = Range("y" & lig).Value
modif = 1
ligmodif = lig
End Sub
Private Sub LR_Click()
NDF = "s:\tests\lettre ligne reguliere.doc"
End Sub
Private Sub mel_keypress(ByVal KeyAscii As MSForms.ReturnInteger)
KeyAscii = Asc(LCase(Chr(KeyAscii)))
End Sub
Private Sub nom_keypress(ByVal KeyAscii As MSForms.ReturnInteger)
KeyAscii = Asc(LCase(Chr(KeyAscii)))
End Sub
Private Sub numcarte_keyPress(ByVal KeyAscii As MSForms.ReturnInteger)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub
Private Sub OptionButton1_Click()
MsgBox "oui"
End Sub
Private Sub Telfixe_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case Is < 48, Is > 57
KeyAscii = 0
End Select
End Sub
Private Sub Telmob_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case Is < 48, Is > 57
KeyAscii = 0
End Select
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = 0 Then Cancel = True
End Sub
Private Sub numcoupon_keypress(ByVal KeyAscii As MSForms.ReturnInteger)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub
Private Sub UserForm_Initialize()
With NOM
.SetFocus
.SelStart = 0
End With
End Sub |
Partager