Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

Dim AnsCh As VbMsgBoxResult

AnsCh = MsgBox("åá ÊÑíÏ ÈÇáÝÚá ÊÚÏíá ÇáÈíÇäÇÊ ¿¿", vbCritical + vbQuestion +


vbYesNo + vbMsgBoxRight + vbMsgBoxRtlReading, "ÊäÈíå")
If AnsCh = vbYes Then

Private Sub txtNom_Change()


txtNom.Value = Application.Proper(txtNom.Value)

End Sub

Private Sub Aj_photo_Click()


On Error Resume Next
openpic = Application.GetOpenFilename(filefilter:="picture files(fichirs
image),*.gif;*.jpg;*.jpeg", Title:="Selectionner une image")
If openpic <> False Then
Me.Image9.Picture = LoadPicture(openpic)
Me.Image9.Visible = True
End If
End Sub

Private Sub ComboBox1_DropButtonClick()


' w: le dernier lignes rempli de la liste
w = Feuil3.Cells(Rows.Count, "A").End(xlUp).Row
ComboBox1.List = Feuil3.Range("A2:A" & w).Value

End Sub

Private Sub Nvx_Enrg_Click()


Dim Add As Integer
Dim Name As String
Name = TextBox3.Value & " " & TextBox4.Value
Dim Ls As Integer
Ls = Application.WorksheetFunction.CountIf(Feuil1.Range("F2:F10000"), Name)
If Ls > 0 Then
MsgBox "Cet adherent exist deja", vbCritical
End If

Add = Feuil1.Range("A10000").End(xlUp).Row + 1
Feuil1.Cells(Add, "A").Value = TextBox1.Value 'No
Feuil1.Cells(Add, "B").Value = TextBox2.Value 'date
Feuil1.Cells(Add, "D").Value = TextBox3.Value 'nom
Feuil1.Cells(Add, "E").Value = TextBox4.Value 'prenom
Feuil1.Cells(Add, "G").Value = TextBox5.Value 'Dnce
Feuil1.Cells(Add, "H").Value = TextBox6.Value 'Adresse
Feuil1.Cells(Add, "I").Value = ComboBox1.Value 'fonction
'secteur
If OBtn1.Value = True Then
Feuil1.Cells(Add, "O").Value = "Public"
Else
If OBtn2.Value = True Then
Else
MsgBox "veuillez indiquer le secteur d'activite", vbCritical, "Attention"
End If
End If
Feuil1.Cells(Add, "O").Value = "Prive"
Feuil1.Cells(Add, "K").Value = TextBox7.Value 'tel
Feuil1.Cells(Add, "L").Value = TextBox8.Value 'email

'picture
namepic = Me.TextBox2.Text & " " & Me.TextBox3.Text
SavePicture Image9.Picture, "C:\Users\Laptop\Desktop\MDA\Pictures" & "\" & namepic
& ".jpg"
pathpic = "C:\MDA\Pictures" & "\" & namepic & ".jpg"
Feuil1.Cells(Add, "P").Value = pathpic
For i = 1 To 8
Controls("TextBox" & i).Value = ""
Next i
ComboBox1.Value = ""
Me.OBtn1.Value = False
Me.OBtn2.Value = False
Me.Image9.Picture = LoadPicture(none)
End Sub

Private Sub TextBox2_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)


If InStr("0123456789/", Chr(KeyAscii)) = 0 Then KeyAscii = 0
End Sub

Private Sub TextBox3_Change()


TextBox3.Text = UCase(TextBox3.Text)
End Sub

Private Sub TextBox7_AfterUpdate()


TextBox7.Value = Format(TextBox7, "00 00 00 00 00")
End Sub

Private Sub TextBox7_Change()


TextBox7.MaxLength = 10
End Sub

Private Sub TextBox7_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)


If InStr("0123456789", Chr(KeyAscii)) = 0 Then KeyAscii = 0
End Sub

Private Sub TextBox8_Change()


TextBox8.Text = LCase(TextBox8.Text)
End Sub

Private Sub UserForm_Initialize()


Dim madate As Date
madate = Now()
TextBox2.Value = Format(madate, "dd / mm / yyyy")

Dim LrN As Integer


LrN = Feuil1.Range("A10000").End(xlUp).Row
TextBox1.Value = Feuil1.Cells(LrN, "A").Value + 1
End Sub

You might also like