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
| Option Explicit
Dim tab_Cust() As String, n_CList As Integer, n_Country As Integer, n_LigneCb As Byte
Dim n_Mois As Byte, n_Annee As Byte, n_LigneJour As Byte, n_x As Integer
Dim ck_Aim As Boolean, str_DNumber As String
Private Sub bt_Add_Click()
Dim ctr_Day As Control, ctr_Month As Control, ctr_Year As Control
Dim cl As Classe1
Dim n_gap As Integer, str_CodeCBmonth As String, str_CodeCByear As String, str_CodeCBday As String
Set co_ColCbBx = New Collection
n_LigneCb = n_LigneCb + 1
n_gap = 24
Set ctr_Day = fm_Payment.MultiPage1.Pages(1).Controls.Add("forms.ComboBox.1", "cb_Day" & n_LigneCb, True)
Set ctr_Month = fm_Payment.MultiPage1.Pages(1).Controls.Add("forms.ComboBox.1", "cb_Month" & n_LigneCb, True)
Set ctr_Year = fm_Payment.MultiPage1.Pages(1).Controls.Add("forms.ComboBox.1", "cb_Year" & n_LigneCb, True)
With ctr_Day
.Height = 18
.Left = 78
.Top = 60 + (n_LigneCb - 1) * n_gap
.Width = 36
End With
With ctr_Month
.Height = 18
.Left = 24
.Top = 60 + (n_LigneCb - 1) * n_gap
.Width = 36
End With
With ctr_Year
.Height = 18
.Left = 132
.Top = 60 + (n_LigneCb - 1) * n_gap
.Width = 60
End With
With fm_Payment
With .MultiPage1.Pages(1)
.Label7.Top = 114 + (n_LigneCb - 1) * n_gap
.tb_Comment.Top = 138 + (n_LigneCb - 1) * n_gap
End With
.MultiPage1.Height = 300 + (n_LigneCb - 1) * n_gap
.bt_Pmt.Top = 324 + (n_LigneCb - 1) * n_gap
.bt_Cancel.Top = 324 + (n_LigneCb - 1) * n_gap
.Height = 382.5 + (n_LigneCb - 1) * n_gap
End With
Debug.Print ctr_Month.Name
Set cl = New Classe1
Set cl.CbBx = ctr_Month
co_ColCbBx.Add cl
Set cl.CbBx = ctr_Year
co_ColCbBx.Add cl
Set cl.CbBx = ctr_Day
co_ColCbBx.Add cl
str_CodeCBmonth = "Private Sub cb_Month" & n_LigneCb & "_DropButtonClick()" & vbCrLf
str_CodeCBmonth = str_CodeCBmonth & "Dim i As Integer" & vbCrLf
str_CodeCBmonth = str_CodeCBmonth & "fm_Payment.cb_Month" & n_LigneCb & ".Clear" & vbCrLf
str_CodeCBmonth = str_CodeCBmonth & "For i = 1 To " & n_Mois & vbCrLf
str_CodeCBmonth = str_CodeCBmonth & "fm_Payment.cb_Month" & n_LigneCb & ".AddItem (sh_Data.Cells(i, 3))" & vbCrLf
str_CodeCBmonth = str_CodeCBmonth & "Next i" & vbCrLf
str_CodeCBmonth = str_CodeCBmonth & "End Sub"
str_CodeCByear = "Private Sub cb_Year" & n_LigneCb & "_DropButtonClick()" & vbCrLf
str_CodeCByear = str_CodeCByear & "Dim i As Integer" & vbCrLf
str_CodeCByear = str_CodeCByear & "fm_Payment.cb_Year" & n_LigneCb & ".Clear" & vbCrLf
str_CodeCByear = str_CodeCByear & "For i = 1 To " & n_Annee & vbCrLf
str_CodeCByear = str_CodeCByear & "fm_Payment.cb_Year" & n_LigneCb & ".AddItem (sh_Data.Cells(i, 5))" & vbCrLf
str_CodeCByear = str_CodeCByear & "Next i" & vbCrLf
str_CodeCByear = str_CodeCByear & "End Sub"
str_CodeCBday = "Private Sub cb_Month" & n_LigneCb & "_Change()" & vbCrLf
str_CodeCBday = str_CodeCBday & "Dim i As Integer" & vbCrLf
str_CodeCBday = str_CodeCBday & "n_LigneJour = sh_Data.Cells(WorksheetFunction.Match(fm_Payment.cb_Month" & n_LigneCb & ".Value, sh_Data.Columns(3), 0), 4).Value" & vbCrLf
str_CodeCBday = str_CodeCBday & "fm_Payment.cb_Day" & n_LigneCb & ".Clear" & vbCrLf
str_CodeCBday = str_CodeCBday & "For i = 1 To n_LigneJour" & vbCrLf
str_CodeCBday = str_CodeCBday & "fm_Payment.cb_Day" & n_LigneCb & ".AddItem (sh_Data.Cells(i, 5))" & vbCrLf
str_CodeCBday = str_CodeCBday & "Next i" & vbCrLf
str_CodeCBday = str_CodeCBday & "End Sub"
With ThisWorkbook.VBProject.VBComponents("fm_Payment").codemodule
n_x = .countoflines + 1
.createeventproc
.InsertLines n_x, str_CodeCBmonth
.InsertLines n_x + 8, str_CodeCByear
.InsertLines n_x + 16, str_CodeCBday
End With
End Sub |
Partager