Welcome to the forum!

'ni = PartDocs(i).GetNumPages()
ni = 1