Firstly when you declare variables you should explicitly define each variable's type
Dim pregunta, opA, opB, opC, opD, ans, respC, explRC, dif, ref, obj, topic, pclave, prof As String
In the above declaration, only prof is a string. All the other variables are variants. It needs to be written as
Dim pregunta as String, opA as String, opB as String
Secondly, your code creates a document and then start looping through the rows and before you move to the next row, you close the document. This means on the second pass of the loop, the document is no longer open.
Did you want one document per row or are you creating a single document containing all the row content?
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
|