Hi,
I have a program that reads a number value for a text file, and then for each line in the text file the number value is incremented by one. The problem is that the number value is padded with zero's and changes for each different file. I am able to increment the value however the 0's are lost when doing so. How do I retain the format of the original value, without knowing how many zero's are padding the number? Below is a sample file, and my code
Sample File:
Test|037120001
Test|037120002
Dim strTmp() as string
Dim numval as string
Open sample file for Input As #1
Do Until EOF(1)
Line Input #1, Data
strTmp = Split(Data,"|"
numval = strTmp(1) + 1
Msgbox numval
Loop
Close #1
With the above code the first value that is returned is
37120002 when I need it to be the original value format
03712002. What am I doing wrong? I tried to set the variable as an integer or long datatype with the same results. Please help
I have a program that reads a number value for a text file, and then for each line in the text file the number value is incremented by one. The problem is that the number value is padded with zero's and changes for each different file. I am able to increment the value however the 0's are lost when doing so. How do I retain the format of the original value, without knowing how many zero's are padding the number? Below is a sample file, and my code
Sample File:
Test|037120001
Test|037120002
Dim strTmp() as string
Dim numval as string
Open sample file for Input As #1
Do Until EOF(1)
Line Input #1, Data
strTmp = Split(Data,"|"
numval = strTmp(1) + 1
Msgbox numval
Loop
Close #1
With the above code the first value that is returned is
37120002 when I need it to be the original value format
03712002. What am I doing wrong? I tried to set the variable as an integer or long datatype with the same results. Please help