Navigation entre userform

Navigation entre userform - VB/VBA/VBS - Programmation

Marsh Posté le 13-07-2011 à 12:52:13    

Bon petite présentation, je monte une appli de 300 userforms.
Je les ai généré en automatique (1 label avec une question "variable" ; 3 optionbutton pour les 3 réponses possibles ; 2 commandbutton pour aller à suivant et précédent )
 
Tout baigne (ou presque ...  :??: )  
Les userforms ont un titre, un label différents; les optionbutton de réponse stockent bien la réponse face à ma question (dans une feuille excel de réponse).    
Mais je n'arrive pas à coder mes commandbutton avec la question précédente en variable et là 300 codes à faire à la main ( :fou: ).
 
Si le bouton est cliquer, je récupère le n° de la question (nom du userform en cours), je balaye la feuille 1 (ordre des questions), j'additionne ou je soustrais 1 à la ligne pour avoir la question suivante ou précédente, et je voudrais afficher cette nouvelle question mais NADA !!!
il ne comprend pas le .show    
 
Les 2 codes
 
Private Sub CommandButton1_Click()
Dim usF As String
Dim lig As Long
For lig = 1 To 300
If Sheets(1).Cells(lig, 1) = Me.Name Then
Sheets(1).Cells(lig - 1, 1) = usF
CommandButton1.Show
End If
Next lig
End Sub
 
Private Sub CommandButton2_Click()
Dim usF As Object
Dim lig As Long
For lig = 1 To 300
If Sheets(1).Cells(lig, 1) = Me.Name Then
Sheets(1).Cells(lig + 1, 1) = usF
usF.Show
End If
Next lig
End Sub
 
 
Idée1 ??
 
Sinon pour avancer, comment faire un show avec variable :  
 
Rien de tout cela ne marche  
Dim maVariable As String
Dim sVariable As String
maVariable = "Question147"
sVariable = "Question147"
 
 
 
'(sVariable).Show
'sVariable.Show
'ThisWorkbook(sVariable).Show
'ThisWorkbook.UserForms(sVariable).Show
'ThisWorkbook.UserForms.Add(maVariable).Show
'ThisWorkbook.VBProject(sVariable).Show
'ThisWorkbook.VBProject.UserForms(sVariable).Show
'ThisWorkbook.VBProject.UserForms.VBComponents(sVariable).Show
'ThisWorkbook.VBProject.UserForms.Show (sVariable)
'ThisWorkbook.VBProject.UserForms.VBComponents.Show (sVariable)
'ThisWorkbook.VBProject.VBComponents(sVariable).Show
'ThisWorkbook.VBProject.VBComponents.Add(maVariable).Show
'ThisWorkbook.VBProject.VBComponents.Add(sVariable).Show
'ThisWorkbook.VBProject.VBComponents.Item(sVariable).Show
'VBProject.UserForms.Show (sVariable)
'VBA.UserForms.Add(sVariable).Show
 
ni ça mais pas tester avec tous les lignes de haut dessus ...
'Set VBComp = ThisWorkbook.VBProject.VBComponents(3)
'Nomme le module à question
'With VBComp
'With Selection
'.Properties("Name" ) = maVariable
'End With
'ThisWorkbook.VBProject.VBComponents (nName)
 
 
 
Idée2 ???
 
A+

Reply

Marsh Posté le 13-07-2011 à 12:52:13   

Reply

Marsh Posté le 18-07-2011 à 11:58:31    

J'ai retester ce matin  
finalement le code  
"VBA.UserForms.Add(usF).Show"
marche aujourd'hui.
 
paramétrage différent ? (car je suis sur un autre micro) ?  
 

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed