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
|
Private Sub UserForm_Activate()
'backcolorM MultiPage1, Array(0, 3, 5), vbRed'certaines pages en rouge
'ou
'
'backcolorM MultiPage1, Array(0, 3, 5), Array(146325, 1723654, 119546) 'certaines pages couleurs différentes
'ou
'
'backcolorM MultiPage1, 0, vbRed ' tout les pages en rouge
'ou
' tout les pages une couleur différente
backcolorM MultiPage1, 0, Array(vbBlue, vbGreen, vbRed, vbCyan, vbMagenta, RGB(123, 187, 45), 134521)
End Sub
'
Private Function backcolorM(obj, Opages As Variant, coul As Variant) As String
Dim x&, i&, img
If Not IsArray(Opages) Then
Opages = Application.Transpose(Evaluate("ROW(1:" & MultiPage1.pages.Count & ")"))
x = 1
End If
For i = LBound(Opages) To UBound(Opages)
Set img = obj.pages(Opages(i) - x).Controls.Add("forms.Image.1", "fond")
With img: .Top = 0: .Left = 0: .Width = obj.Width: .Height = obj.Height: .ZOrder 1:
If IsArray(coul) Then
.BackColor = coul(i - x)
Else
.BackColor = coul
End If
End With
Next
End Function |
Partager