Variable dans MsgBox

szteam Messages postés 59 Date d'inscription mercredi 25 octobre 2000 Statut Membre Dernière intervention 19 janvier 2004 - 29 juin 2002 à 19:51
GtommarC Messages postés 37 Date d'inscription lundi 20 mai 2002 Statut Membre Dernière intervention 25 avril 2003 - 30 juin 2002 à 06:02
Boujour a tous voila je débute et je voudrai savoir comment on inclut un variable dans une MsgBox par exemple :
inclure la variable NBcoupv aprés "en" dans :
MsgBox "Bravo t'as trouvé le bon nombre! en ici donc", vbExclamation, "Bravo!"
Merci
CIAO
SZ

3 réponses

GtommarC Messages postés 37 Date d'inscription lundi 20 mai 2002 Statut Membre Dernière intervention 25 avril 2003
29 juin 2002 à 20:01
dim strvar as string
strvar = Bravo t'as trouvé le bon nombre! en" & NBcoupv & "ici donc"
MsgBox (strvar, vbExclamation, "Bravo!")
a++

GtommarC
0
leneuf22 Messages postés 156 Date d'inscription samedi 12 janvier 2002 Statut Membre Dernière intervention 4 mars 2003 1
29 juin 2002 à 22:27
Fais gaffe, GtommarC !
Ton code ne marche pas !
MsgBox (strvar, vbExclamation, "Bravo!")

JAMAIS ces parenthèses qand le résultat est affecté à une variable.

c'est MsgBox (strvar), vbExclamation, "Bravo!"
ou MsgBox strvar, vbExclamation, "Bravo!"
qu'il faut écrire

Pour éviter de créer une variable tu peux aussi écrire :

MsgBox ("Bravo t'as trouvé le bon nombre! en" & NBcoupv & "ici donc"), vbExclamation, "Bravo!"

(avec ou sans parenthèses)
0
GtommarC Messages postés 37 Date d'inscription lundi 20 mai 2002 Statut Membre Dernière intervention 25 avril 2003
30 juin 2002 à 06:02
ok dans ma préciîtatopn j'ai oublié cz qui marche c'est
réponse = MsgBox (strvar, vbExclamation, "Bravo!")

GtommarC
0
Rejoignez-nous