Massimo, shouldn't your if statement be:
If oEl.IsTextElement Then ' if element is text and level name = ril_quote numbercase = 2 If oEl.Level.Name = "ril_quote" Then numbercase = 2 ElseIf oEl.Level.Name = "z_profondita" Then ' if element is text and level name = z_profondità numercase=3 numbercase = 3 End If End If
I also note your level name in the comment is different to that in the statement; the last letter contains an accent above it called Grave in English (which I think is called Accento grave in Italian). It might not be an issue if your are not including such symbols in your level names.