ho risolto così:
------------------------
p = 12 [numero che può andare da 1 a 99999)
if p < 10 then strP = "0000" & p
else if p < 100 then strP = "000" & p
else if p < 1000 then strP = "00" & p
else if p < 10000 then strP = "0" & p
end if
------------------------
in modo da avere sempre un numero di 5 cifre
esempio:
p= "12"
viene trasformato in
p="00012"