Bonjour,
Je suis très débutant en vba (mais pas en dev) et je suis confronté à un problème que j'arrive toujours pas à résoudre:
J'ai des catégories qui contiennent un ensemble de questions; qui elles même contiennent une liste de réponses possibles!
Donc j'ai créé trois diffèrent types et mon problème commence a la création et à la valuation des objets.

Voici un bout de code qui est sensé retourner une catégorie valuée:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
Function getAllQuestions(categoryname As String, categoriesRange As Range) As Category
Dim i, j, k As Integer
i = 1
j = 1
k = 1
getAllQuestions = New Category
With getAllQuestions
Let getAllQuestions.name = categoryname
Let getAllQuestions.Questions = New Question
 
For Each currentCell In categoriesRange
    If currentCell.Value = categoryname Then
        j = 2
        getAllQuestions.Questions(i) = New Question
        With getAllQuestions.Question(i)
            .label = Cells(currentCell.Row, j).Value
            j = j + 1
            While Cells(currentCell.Row, j).Value <> ""
                Let getAllQuestions.Question(i).answer(k) = New answer
                Let getAllQuestions.Question(i).answer(k).label = Cells(currentCell.Row, j).Value
                j = j + 1
                Let getAllQuestions.Question(i).answer(k).weight = Cells(currentCell.Row, j).Value
                j = j + 1
                k = k + 1
            Wend
        End With
    End If
Next
Est ce que qq un aurai une idée par quoi je pourrai commencer parce que je sens que je vais bientôt cracker!
Merci d'avance.


Ayinay