zazadec
Messages postés31Date d'inscriptionvendredi 21 janvier 2005StatutMembreDernière intervention30 juin 2008
-
17 avril 2007 à 18:35
jrivet
Messages postés7392Date d'inscriptionmercredi 23 avril 2003StatutMembreDernière intervention 6 avril 2012
-
18 avril 2007 à 14:27
Slt,
Petit code à optimiser afin de na pas avoir un fichier de 1Mo
If SSA_CLO.
PARAM1
_OK.Value = True Then
ActiveDocument.Bookmarks("
PARAM1
_OK").Range.Text = CHECK
Else
ActiveDocument.Bookmarks("
PARAM1
_KO").Range.Text = CHECK
If SSA_CLO.
PARAM1
_ACTION_BUTTON_S Then
ActiveDocument.Bookmarks("
PARAM1
_ACTION").Range.Text = CHECK_S
Else
If SSA_CLO.
PARAM1
_ACTION_BUTTON_A = True Then
ActiveDocument.Bookmarks("
PARAM1
_ACTION").Range.Text = CHECK_A
Else
If SSA_CLO.
PARAM1
_ACTION_BUTTON_CI = True Then
ActiveDocument.Bookmarks("
PARAM1
_ACTION").Range.Text = CHECK_CI
Else
If SSA_CLO.
PARAM1
_ACTION_BUTTON_CE = True Then
ActiveDocument.Bookmarks("PARAM1_ACTION").Range.Text = CHECK_CE
End If
End If
End If
End If
End If
If SSA_CLO.
PARAM2
_OK.Value = True Then
ActiveDocument.Bookmarks("
PARAM2
_OK").Range.Text = CHECK
Else
ActiveDocument.Bookmarks("PARAM2_KO").Range.Text = CHECK
If SSA_CLO.
PARAM2
_ACTION_BUTTON_S Then
ActiveDocument.Bookmarks("
PARAM2
_ACTION").Range.Text = CHECK_S
Else
If SSA_CLO.
PARAM2
_ACTION_BUTTON_A = True Then
ActiveDocument.Bookmarks("
PARAM2
_ACTION").Range.Text = CHECK_A
Else
If SSA_CLO.
PARAM2
_ACTION_BUTTON_CI = True Then
ActiveDocument.Bookmarks("
PARAM2
_ACTION").Range.Text = CHECK_CI
Else
If SSA_CLO.
PARAM2
_ACTION_BUTTON_CE = True Then
ActiveDocument.Bookmarks("PARAM2_ACTION").Range.Text = CHECK_CE
End If
End If
End If
End If
End If
...
If SSA_CLO.
PARAM50
_OK.Value = True Then
ActiveDocument.Bookmarks("
PARAM50
_OK").Range.Text = CHECK
Else
ActiveDocument.Bookmarks("
PARAM50
_KO").Range.Text = CHECK
If SSA_CLO.
PARAM50
_ACTION_BUTTON_S Then
ActiveDocument.Bookmarks("
PARAM50
_ACTION").Range.Text = CHECK_S
Else
If SSA_CLO.
PARAM50
_ACTION_BUTTON_A = True Then
ActiveDocument.Bookmarks("
PARAM50
_ACTION").Range.Text = CHECK_A
Else
If SSA_CLO.
PARAM50
_ACTION_BUTTON_CI = True Then
ActiveDocument.Bookmarks("
PARAM50
_ACTION").Range.Text = CHECK_CI
Else
If SSA_CLO.PARAM50_ACTION_BUTTON_CE = True Then
ActiveDocument.Bookmarks("
PARAM50
_ACTION").Range.Text = CHECK_CE
End If
End If
End If
End If
End If
jrivet
Messages postés7392Date d'inscriptionmercredi 23 avril 2003StatutMembreDernière intervention 6 avril 201260 18 avril 2007 à 08:32
Salut,
Je rejoint [auteurdetail.aspx?ID= 615490 jmfmarques], pour la nécessité de poster dans la bonne section.
Tiens regarde ce petit bout de code. je ne sais pas si il convient. A toi de voir l'idée et de t'en inspirer. Si toutefois tu pilotes Word depuis VB6 il est préférable de faire des groupes de contrôle comme proposé par [auteurdetail.aspx?ID=615490 jmfmarques] 'Les Appels
With SSA_CLO
Call ProcessEx(.PARAM1_OK, .PARAM1_ACTION_BUTTON_S, .PARAM1_ACTION_BUTTON_A, .PARAM1_ACTION_BUTTON_CI, _
.PARAM1_ACTION_BUTTON_CE, "PARAM1_OK", "PARAM1_KO", "PARAM1_ACTION")
Call ProcessEx(.PARAM2_OK, .PARAM2_ACTION_BUTTON_S, .PARAM2_ACTION_BUTTON_A, .PARAM2_ACTION_BUTTON_CI, _
.PARAM2_ACTION_BUTTON_CE, "PARAM2_OK", "PARAM2_KO", "PARAM2_ACTION")
'[...]
Call ProcessEx(.PARAM50_OK, .PARAM50_ACTION_BUTTON_S, .PARAM50_ACTION_BUTTON_A, .PARAM50_ACTION_BUTTON_CI, _
.PARAM50_ACTION_BUTTON_CE, "PARAM50_OK", "PARAM50_KO", "PARAM50_ACTION")
End With
'LA PROCEDURE:
'ATTENTION JE SUPPOSE QUE les contrôle SSA_CLO.PARAM50_OK SSA_CLO.PARAM50_ACTION_BUTTON_CI ETC..., SONT DES CHECKBOX
Public Sub ProcessEx(ByRef ChkOK As CheckBox, ByRef Chk_S As CheckBox, ByRef Chk_A As CheckBox, _
ByRef Chk_CI As CheckBox, ByRef Chk_CE As CheckBox, _
ByVal ParamOK As String, ByVal ParamKO As String, ByVal ParamAction As String)
If ChkOK.Value Then
ActiveDocument.Bookmarks(ParamOK).Range.Text = Check
Else
ActiveDocument.Bookmarks(ParamKO).Range.Text = Check
If Chk_S Then ActiveDocument.Bookmarks(ParamAction).Range.Text = CHECK_S: Exit Sub
If Chk_A Then ActiveDocument.Bookmarks(ParamAction).Range.Text = CHECK_A: Exit Sub
If Chk_CI Then ActiveDocument.Bookmarks(ParamAction).Range.Text = CHECK_CI: Exit Sub
If Chk_CE Then ActiveDocument.Bookmarks(ParamAction).Range.Text = CHECK_CE: Exit Sub
End If
End Sub<hr />, ----
[code.aspx?ID=41455 By Renfield]
jrivet
Messages postés7392Date d'inscriptionmercredi 23 avril 2003StatutMembreDernière intervention 6 avril 201260 18 avril 2007 à 13:48
Re,
Les boutons que tu utilises ne sont pas des CommandButton mais des ToggleButton d'où l'incompatibilté de type, tu ne peux passer des togglebutton à une procédure qui attend des CommandButton
Il Faut donc mettre
Public Sub ProcessEx(ByRef ChkOK As OptionButton, ByRef Chk_S As ToggleButton, ByRef Chk_A As ToggleButton, _
ByRef Chk_CI As ToggleButton, ByRef Chk_CE As ToggleButton, _
ByVal ParamOK As String, ByVal ParamKO As String, ByVal ParamAction As String)
, ----
[code.aspx?ID=41455 By Renfield]
Voila continue tes test avec cette modif pour voir si ca marche
@+: Ju£i?n Pensez: Réponse acceptée
jmfmarques
Messages postés7666Date d'inscriptionsamedi 5 novembre 2005StatutMembreDernière intervention22 août 201427 17 avril 2007 à 19:35
Je n'ai jeté qu'un très rapide coup d'oeil (on m'attend pour sortir) :
Mais déjà : utilise donc des groupes de contrôles indexés et joue avec les index .
Et non ! zut !
T'as "posté" sous VB6 mais certains éléments de ton code me donnent à penser que tu es sous VBA (qui n'a pas de groupes indexés) !!!
D'où, UNE FOIS DE PLUS, la nécessité de poster dans la bonne section !...
zazadec
Messages postés31Date d'inscriptionvendredi 21 janvier 2005StatutMembreDernière intervention30 juin 2008 18 avril 2007 à 10:37
1000 excuses. Je suis bien sous word donc forcement en VBA. Et mes box sont des 'OptionButton' et des 'CommanButton'.
Je viens de tester ce code que j'ai arrangé mais il bloque sur le 1er call ProcessEx en me balançant 'argument non facultatifs'. Donc forcement je ne comprend pas.
Vous n’avez pas trouvé la réponse que vous recherchez ?
jrivet
Messages postés7392Date d'inscriptionmercredi 23 avril 2003StatutMembreDernière intervention 6 avril 201260 18 avril 2007 à 10:49
Salut,
1 -Il faut donc que tu remplaces
Public Sub ProcessEx(ByRef ChkOK As CheckBox, ByRef Chk_S As CheckBox, ByRef Chk_A As CheckBox, _
ByRef Chk_CI As CheckBox, ByRef Chk_CE As CheckBox, _
ByVal ParamOK As String, ByVal ParamKO As String, ByVal ParamAction As String)
End Sub
PAR
<hr />Public Sub ProcessEx(ByRef ChkOK As OptionButton, ByRef Chk_S As CommandButton, ByRef Chk_A As CommandButton, _
ByRef Chk_CI As CommandButton, ByRef Chk_CE As CommandButton, _
ByVal ParamOK As String, ByVal ParamKO As String, ByVal ParamAction As String)
End Sub , ----
[code.aspx?ID= 41455 By Renfield]
En revanche il y a qqch que je ne comprend pas, si SSA_CLO.PARAM2_ACTION_BUTTON_A est un commandButton, qu'entedns par SSA_CLO.PARAM2_ACTION_BUTTON_A = TRUE
Enfin pour finir si tu ne place pas le code que tu as mis je ne pourrais pas te dire pourquoi il te marque argument non facultatifs'
zazadec
Messages postés31Date d'inscriptionvendredi 21 janvier 2005StatutMembreDernière intervention30 juin 2008 18 avril 2007 à 11:39
D'abord, merci de ta réactivité.
Ensuite, j'ai mis le positionnement de mes variables derriere mon boutton 'Valider' (j'ai remplacer mes variables PARAM1 PARAM2 ... par le vrai nom)
Puis dans le module 'Validation', j'ai inséré ceci
Public Sub ProcessEx(ByRef ChkOK As OptionButton, ByRef Chk_S As CommandButton, ByRef Chk_A As CommandButton, _
ByRef Chk_CI As CommandButton, ByRef Chk_CE As CommandButton, _
ByVal ParamOK As String, ByVal ParamKO As String, ByVal ParamAction As String)
If ChkOK.Value Then
ActiveDocument.Bookmarks(ParamOK).Range.Text = CHECK
Else
ActiveDocument.Bookmarks(ParamKO).Range.Text = CHECK
If Chk_S Then ActiveDocument.Bookmarks(ParamAction).Range.Text = CHECK_S: Exit Sub
If Chk_A Then ActiveDocument.Bookmarks(ParamAction).Range.Text = CHECK_A: Exit Sub
If Chk_CI Then ActiveDocument.Bookmarks(ParamAction).Range.Text = CHECK_CI: Exit Sub
If Chk_CE Then ActiveDocument.Bookmarks(ParamAction).Range.Text = CHECK_CE: Exit Sub
End If
End Sub
Et là ca me donne une 'incompatibilité de type'.
Qu'en penses-tu ? Ou je me trompe ?
jrivet
Messages postés7392Date d'inscriptionmercredi 23 avril 2003StatutMembreDernière intervention 6 avril 201260 18 avril 2007 à 11:50
Salut,
VBA doit être sympa il me semble et te surligner le parametre qui est en incompatibilité de Type. A toi de me dire le quelle est ce.
Car moi je ne suis pas devantton PC.
jrivet
Messages postés7392Date d'inscriptionmercredi 23 avril 2003StatutMembreDernière intervention 6 avril 201260 18 avril 2007 à 13:12
Salut,
Vu que j'ai un peu de temps libre je peux te proposer de m'envoyer ton document a epsylon9@gmail.com
Je testerai de mon coté car la j'ai un peu de mal à voir pourquoi.