[Catégorie modifiée VB6 -> VBA] probleme pour appeler une macro

maxxx08 Messages postés 33 Date d'inscription mercredi 25 mai 2011 Statut Membre Dernière intervention 3 mai 2012 - 8 juin 2011 à 09:47
cs_Jack Messages postés 14006 Date d'inscription samedi 29 décembre 2001 Statut Modérateur Dernière intervention 28 août 2015 - 8 juin 2011 à 10:33
bonjour,

voici mon exemple
dans un premier temps je déclare les variables que je vais utiliser
ensuite je configure les variables par rapport aux checkbox true ou false
ensuite dans la procédure générale Private Sub CommandButton2_Click()
j'appel la configuration des checkboxs mais cela ne marche pas
j'espère que vous allez pouvoir m'aider merci

Dim CBox_Auto_GD
Dim CBox_Auto_G
Dim CBox_Auto_D
Dim CBox_Manu_GD
Dim CBox_Manu_G
Dim CBox_Manu_D

Sub config_checkboxs()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'CONFIGURATIONS
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'Configuration CheckBox's
    ''''''''''''''''''''''''''''''''''''''''''''
CBox_Auto_GD CheckBox1 True And CheckBox2 = False And CheckBox3 = False And CheckBox4 = True And CheckBox5 = True And CheckBox6 = True And CheckBox7 = False And CheckBox8 = False And CheckBox9 = False And CheckBox10 = False And CheckBox11 = True And CheckBox12 = True
CBox_Auto_G CheckBox1 False And CheckBox2 = True And CheckBox3 = False And CheckBox4 = True And CheckBox5 = True And CheckBox6 = True And CheckBox7 = False And CheckBox8 = False And CheckBox9 = False And CheckBox10 = False And CheckBox11 = True And CheckBox12 = True
CBox_Auto_D CheckBox1 False And CheckBox2 = False And CheckBox3 = True And CheckBox4 = True And CheckBox5 = True And CheckBox6 = True And CheckBox7 = False And CheckBox8 = False And CheckBox9 = False And CheckBox10 = False And CheckBox11 = True And CheckBox12 = True
CBox_Manu_GD CheckBox1 True And CheckBox2 = False And CheckBox3 = False And CheckBox4 = True And CheckBox5 = True And CheckBox6 = True And CheckBox7 = True And CheckBox8 = True And CheckBox9 = True And CheckBox10 = True And CheckBox11 = False And CheckBox12 = False
CBox_Manu_G CheckBox1 False And CheckBox2 = True And CheckBox3 = False And CheckBox4 = True And CheckBox5 = True And CheckBox6 = True And CheckBox7 = True And CheckBox8 = True And CheckBox9 = True And CheckBox10 = True And CheckBox11 = False And CheckBox12 = False
CBox_Manu_D CheckBox1 False And CheckBox2 = False And CheckBox3 = True And CheckBox4 = True And CheckBox5 = True And CheckBox6 = True And CheckBox7 = True And CheckBox8 = True And CheckBox9 = True And CheckBox10 = True And CheckBox11 = False And CheckBox12 = False
End Sub

Private Sub CommandButton2_Click()

Call config_checkboxs

If CBox_Auto_GD Then
MsgBox "a"
End If
If CBox_Auto_G Then
MsgBox "b"
End If
If CBox_Auto_D Then
MsgBox "c"
End If
If CBox_Manu_GD Then
MsgBox "d"
End If
If CBox_Manu_G Then
MsgBox "e"
End If
If CBox_Manu_D Then
MsgBox "f"
End If

Call arreter

End Sub

3 réponses

lolokun Messages postés 1241 Date d'inscription mardi 10 octobre 2006 Statut Membre Dernière intervention 27 août 2013 7
8 juin 2011 à 09:56
Bnjour,

Heuu je crois qu'il va falloir revoir la partie de configuration car pas clair du tout..
il faut plutot faire un truc du genre :

if checkbox.value = true and checkbox2.value=false.... then
Cbox_auto_GD = true
else if .......... then
CBox_Auto_G = false

end if


L'expérience, c'est une connerie par jour, mais jamais la même..
0
maxxx08 Messages postés 33 Date d'inscription mercredi 25 mai 2011 Statut Membre Dernière intervention 3 mai 2012
8 juin 2011 à 10:26
rep lolokun,

tu as raison ma partie configuration n'est pas clair mais lorsque j’intègre cette partie dans Private Sub CommandButton2_Click() mes conditions avec les IF et msgbox fonctionne.

et j'ai essayé de faire comme tu m'as dit mais ceci ne fonctionne toujours pas.

peut me trouver une solution STP
0
cs_Jack Messages postés 14006 Date d'inscription samedi 29 décembre 2001 Statut Modérateur Dernière intervention 28 août 2015 79
8 juin 2011 à 10:33
Salut

VB6 n'est pas la version 6 de VBA --> Catégorie encore modifiée.
Merci d'y prêter attention.

"ça ne marche pas" ne suffit pas à décrire un problème.

Les lignes de ta Sub config_checkboxs ne veulent absolument rien dire.
Que sont-elles sensé faire ?

Si le compilateur ne gueule pas, c'est que tu dois avoir un "On Error Resume Next" quelque part : Supprime les tous, tu sauras ainsi quelles lignes posent problème.
Demande une compilation (menu Debogage)

Vala
Jack, MVP VB
NB : Je ne répondrai pas aux messages privés

Le savoir est la seule matière qui s'accroit quand on la partage (Socrate)
0
Rejoignez-nous