Overflow error at counting docs

Hi there.

I have a problem. I have an agent to export docs to word and excel. This agent ran perfectly but now I have this problem:

In the beginning for my angent I have a counter to count the docs to be exported. I ran this agent about 5 times and now I get this error: Overflow in line xx.

In line xx theres the code:

If doccont Is Nothing Then

	contagem = col.Count

Else

	contagem = col.Count - doccont.contador(0)

End If

What have I supose to do to repair this problem and it runs again?

Subject: You are probably using an integer as your counter?

integers have a max value of something like 32767 and a lower limit of -32768. Check to see if the count overflows with the same number every time. I bet it does.

try using a long

Subject: It Worked!

Thanks for your help!

It worked perfectly. I changed all counts elements from Interger to Long and the code ran as always!