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
|
Sub AddTextBox(strName As String, iLeft As Integer, _
iTop As Integer, iWidth As Integer, iHeight As Integer, _
iTag As String, Optional bMultipage As Boolean = False, _
Optional PageNum As Integer = 0, Optional Alignment As Integer = fmTextAlignRight)
Dim Obj As Object
If bMultipage Then
Set Obj = MultiPage1.Pages(PageNum).Controls.Add("forms.Textbox.1")
Else
Set Obj = Me.Controls.Add("forms.Textbox.1")
End If
With Obj
.name = strName
.Left = iLeft
.Top = iTop
.Width = iWidth
.Height = iHeight
.Tag = iTag
.TextAlign = Alignment
End With
AddEventTextboxSoldeBeforeUpdate Obj
End Sub
Sub AddEventTextboxSoldeBeforeUpdate(oCtrl As Object)
Dim X As Long
With ActiveWorkbook.VBProject.VBComponents("f_MaJSoldes").CodeModule
X = .CountOfLines
.InsertLines X + 1, "Private Sub " & oCtrl.name & "_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)"
.InsertLines X + 2, "ActualiseCelluleClasseur Me." & oCtrl.name & ", 6"
.InsertLines X + 3, "End Sub"
End With
End Sub |
Partager