bonjour
j'essaye de faire avec la procédure, qui fonctionne avec une cellule qui au passage m'arrange bien les bidons, mais j'essaye de l'appliquer à un userform qui s'appelle formulaire1 et renvoyer la value du dtpiker1 dans le texbox15 ,il est lui-même dans formulaire, je le fais venir le dtpiker1 quand mon formulaire est ouvert par ceci
1 2
| Private Sub TextBox15_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)LancementProcedure
End Sub |
j'ai modifie cette ligne qui dans userform du DTPicker1
ActiveCell.Value = Format(DateSerial(Year(DTPicker1), Month(DTPicker1), Day(DTPicker1)), "dd mmmm yyyy")
par ceci
Formulaire1.TextBox15.Value = Format(DateSerial(Year(DTPicker1), Month(DTPicker1), Day(DTPicker1)), "dd mmmm yyyy")
ma question es que je doit modifier la fonction
es que je dois modifié la fonction qui es ceci
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
| Function UserForm_Et_DataPicker_Dynamique(NomObjet As String) As Object
Dim Obj As Object
Dim j As Integer
Set Usf = ThisWorkbook.VBProject.VBComponents.Add(3)
With Usf
.Properties("Caption") = "Mon calendrier"
.Properties("Width") = 130
.Properties("Height") = 40
End With
Set Obj = Usf.Designer.Controls.Add("MSComCtl2.DTPicker.2")
With Obj
.Left = 0: .Top = 0: .Width = 130: .Height = 20
.Name = NomObjet
.CalendarBackColor = &HFF00FF
End With
With Usf.CodeModule
j = .CountOfLines
.insertlines j + 1, "Sub " & NomObjet & "_Change()"
.insertlines j + 2, " ActiveCell.Value = Format(DateSerial(Year(" _
& NomObjet & "), Month(" & NomObjet & "), Day(" _
& NomObjet & ")), " & Chr(34) & "dd mmmm yyyy" & Chr(34) & ")"
'Option pour refermer l'userform après l'insertion de la date.
.insertlines j + 3, " Unload Me"
.insertlines j + 4, "End Sub"
End With
VBA.UserForms.Add (Usf.Name)
Set UserForm_Et_DataPicker_Dynamique = UserForms(UserForms.Count - 1)
End Function |
Partager