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
|
Sub MonBouton()
Dim action As String
Dim Btn As Shape
Dim Fe As Worksheet
Dim Arg1 As Integer
Dim Arg2 As Long
Dim Arg3 As Double
Dim Arg4 As Single
Dim B As Boolean
Dim D As Date
Set Fe = Worksheets("Feuil1")
Set Btn = Fe.Shapes.AddFormControl(xlButtonControl, 0, 0, 100, 30)
Arg1 = 10
Arg2 = 2000
Arg3 = 31.256
Arg4 = 125.47
B = True
D = #7/3/2014#
'tripler les guillemets pour les arguments String, Double, Single, Date et Boolean
action = "'synthese2 """ & Fe.Name & """," & Arg1 & "," & Arg2 & ",""" & Arg3 & """,""" & Arg4 & """,""" & B & """,""" & D & "'"
With Btn
.TextFrame.Characters.Caption = "Synthèse"
.OnAction = action
End With
End Sub
Sub synthese2(NomFeuille As String, A1 As Integer, A2 As Integer, A3 As Double, A4 As Single, B As Boolean, D As Date)
MsgBox NomFeuille & vbCrLf & A1 & vbCrLf & A2 & vbCrLf & A3 & vbCrLf & A4 & vbCrLf & B & vbCrLf & D
End Sub |
Partager