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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
| Sub interface()
Dim combo As OLEObject, ListB As OLEObject, Lab1 As OLEObject, Lab2 As OLEObject, Lab As OLEObject
Dim TextB As OLEObject, Lab4 As OLEObject, ListB2 As OLEObject
Dim e, tablocombo, i, r, fond
deleting
Application.ScreenUpdating = False
With Worksheets("Feuil1")
.Activate
Set r = ActiveWindow.VisibleRange
'on ajoute le fond d'ecran
Set fond = .Shapes.AddShape(msoShapeRectangle, 0, 0, r.Width, r.Height)
fond.Name = "acce"
fond.Fill.UserPicture ("https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcSeY9rtmGyaS12lNOWYtfQjkB7rPFwkYQBqEfrPUN7JKAR_4UdTQg")
ReDim tablocombo(4)
tablocombo(0) = "Choisir une Réunion"
tablocombo(1) = "Réunion 1"
tablocombo(2) = "Réunion 2"
tablocombo(3) = "Réunion 3"
tablocombo(4) = "Réunion 4"
'Aujourd'hui
Set combo = .OLEObjects.Add("Forms.ComboBox.1")
With combo
.Name = "ComboBox1"
.Object.ColumnCount = 1
.Height = 20
.Width = 116
.Left = .Parent.Columns("E").Left 'Coin supérieur gauche aligné au niveau de la colonne "C"
.Top = .Parent.Rows(2).Top 'Coin supérieur gauche aligné sur la ligne n°2
.Object.Clear
.Object.List = tablocombo
.Object.ListIndex = 0
End With
Set Lab1 = .OLEObjects.Add("Forms.Label.1")
With Lab1
.Name = "Label1"
.Object.Caption = "Choix Réunion -->"
.Object.ForeColor = vbBlack
.Object.BackColor = vbGreen
.Height = 20
.Object.Font.Size = .Height / 1.2
.Width = 116
.Left = .Parent.Columns("C").Left
.Top = .Parent.Rows(2).Top
.Object.TextAlign = 2
End With
Set TextB = .OLEObjects.Add("Forms.TextBox.1")
With TextB
.Name = "TextBox1"
.Height = 20
.Width = 70
.Left = .Parent.Columns("A").Left 'Coin supérieur gauche aligné au niveau de la colonne "C"
.Top = .Parent.Rows(3).Top 'Coin supérieur gauche aligné sur la ligne n°10
.Object.Text = CStr(Date)
End With
Set Lab2 = .OLEObjects.Add("Forms.Label.1")
With Lab2
.Name = "Label2"
.Object.Caption = "Date du jour"
.Object.ForeColor = vbBlack
.Object.BackColor = vbYellow
.Height = 15
.Object.Font.Size = .Height / 1.2
.Width = 70
.Left = .Parent.Columns("A").Left
.Top = .Parent.Rows(2).Top
.Object.TextAlign = 2
End With
Set Lab3 = .OLEObjects.Add("Forms.Label.1")
With Lab3
.Name = "Label3"
.Object.Caption = " Partants à jouer dans chaque courses "
.Object.ForeColor = vbGreen
.Object.BackColor = vbBlack
.Height = 30
.Object.Font.Size = .Width / 5
.Width = 500
.Left = .Parent.Columns("A").Left
.Top = .Parent.Rows(17).Top
.Object.TextAlign = 2
.Object.SpecialEffect = 2
.Object.Font.Italic = True
.Object.Font.Bold = True
End With
Set Lab4 = .OLEObjects.Add("Forms.Label.1")
With Lab4
.Name = "start"
.Object.Caption = " Courses jouables "
.Object.ForeColor = &H0&
.Object.BackColor = &HC0C0C0
.Height = 20
.Object.Font.Size = .Width / 5
.Width = 150
.Left = .Parent.Columns("D").Left
.Top = .Parent.Rows(9).Top
.Object.TextAlign = 2
.Object.SpecialEffect = 1
.Object.Font.Italic = True
.Object.Font.Bold = True
.Object.MousePointer = 14
End With
'**********************************************************************************************************
'Appel sub create listview
create
'Appel sub create_ListBox_resultat
create_ListBox_resultat
End With
Set combo = Nothing
Set TextB = Nothing
Set Lab1 = Nothing
Set Lab2 = Nothing
Set Lab3 = Nothing
Set ListB = Nothing
Application.ScreenUpdating = True
End Sub
Sub deleting()
Dim shap: Application.DisplayAlerts = False
Sheets(1).Cells(1, 1).Resize(4, 10) = ""
For Each shap In Sheets(1).Shapes: shap.Delete: Next
'ThisWorkbook.Save
End Sub
Sub create()
create_listview 4, 9, ActiveSheet.Shapes("start")
End Sub
Sub create_listview(ligne, colonne, ctrl)
Application.ScreenUpdating = False
tops = ctrl.Top + ctrl.Height
lefts = ctrl.Left - 200
With ActiveSheet.Shapes.AddShape(1, lefts, tops, 52, 17)
.Name = "list"
'.TextFrame.Characters.Text = "Reunion"
.Fill.ForeColor.RGB = RGB(255, 100, 100)
.OnAction = ""
End With
For i = 1 To colonne
lefts = lefts + 52
With ActiveSheet.Shapes.AddShape(1, lefts, tops, 52, 17)
.Name = "listt" & i
.TextFrame.Characters.Text = "Course " & i
.Fill.ForeColor.RGB = RGB(255, 100, 0)
End With
Next
tops = tops + 17
coul = 70
For L = 1 To ligne
coul = IIf(coul = 50, 100, 50)
With ActiveSheet.Shapes.AddShape(1, ctrl.Left - 200, tops, 52, 17)
.Name = "list" & L
.TextFrame.Characters.Text = "R" & L
.Fill.ForeColor.RGB = RGB(245, 150, coul)
End With
lefts = ctrl.Left - 148 '+ 52
For col = 1 To colonne
With ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, lefts, tops, 52, 17)
.Name = "listC" & col
valeur = "R" & L & "C" & col
.TextFrame.Characters.Text = valeur '<-- nom de la zone de texte
lefts = lefts + 52
.Fill.ForeColor.RGB = RGB(255, 160, coul + 10)
.OnAction = "'rxcx " & Chr(34) & valeur & "'" 'tout les bouton vont vers la meme sub
End With
Next
tops = tops + 17
Next
Range("A1").Activate '<-- permet de quitter la sélection de la zone de texte
End Sub
Sub rxcx(v)
MsgBox v
'ici tu fait ce que tu veux avec V !!!!
End Sub
Sub create_ListBox_resultat()
Dim lst As OLEObject
With ActiveSheet
Set lst = .OLEObjects.Add("Forms.ListBox.1", Left:=0, Top:=Cells(20, 1).Top, Width:=500, Height:=100)
With lst
.Name = "listV"
'.Width = 10 * 51
.Left = .Parent.Columns("A").Left
.Top = .Parent.Rows(20).Top
.Object.BackColor = &H8000000A
.Object.ForeColor = &H80000008
.Object.TextAlign = 2
.Object.ColumnCount = 4
.Object.ColumnWidths = "80;80;80;80"
.Visible = False
.Visible = True
End With
tops = lst.Parent.Rows(19).Top
lefts = 0
For i = 1 To 4
'.AddShape(Type, Left, Top, Width, Height)
With .Shapes.AddShape(1, lefts, tops, 125, 15)
.Name = "listR" & i
.TextFrame.Characters.Text = "Réunion " & i
.TextFrame.Characters.Font.Bold = True
.TextFrame.Characters.Font.Italic = True
.TextFrame.Characters.Font.Size = 14
.TextFrame.HorizontalAlignment = xlHAlignCenter
.TextFrame.VerticalAlignment = xlVAlignCenter
.Fill.ForeColor.RGB = RGB(160, 160, 160)
End With
lefts = lefts + 125
Next i
End With
End Sub |