FrankFrankel
Technical User
Hi
I have a big bunch of text that I need to parse for product codes. There are multiple codes in the text and I want to save them in a table. I've managed to get the text into a variable, and successfully find the first product code. I don't know how to loop through the rest of the text variable until the end.
I was considering FreeFile, but since I managed to insert the text into a variable already I decided to skip it. Can someone shed some light on a possible solution?
Here is the section I want to loop
----------------LOOP UNTIL END OF VARIABLE---------
'parse for END OF PRODUCT CODE
endcode = InStr(1, Productfile, Search)
'LOOP UNTIL START OF PRODUCT CODE
A = 1
Do Until startcode = "/"
startcode = Mid(Productfile, (endcode - A), 1)
A = A + 1
Loop
'FIND THE PRODUCT CODE USING START AND END VARIABLES
PRODUCTCODE(ARR) = Mid(Productfile, (endcode - (A - 2)), (A - 4))
'SAVE THE PRODUCTCODE IN THE ARRAY
ARR = ARR + 1
ReDim Preserve PRODUCTCODE(ARR)
----------------LOOP UNTIL END OF VARIABLE---------
I have a big bunch of text that I need to parse for product codes. There are multiple codes in the text and I want to save them in a table. I've managed to get the text into a variable, and successfully find the first product code. I don't know how to loop through the rest of the text variable until the end.
I was considering FreeFile, but since I managed to insert the text into a variable already I decided to skip it. Can someone shed some light on a possible solution?
Here is the section I want to loop
----------------LOOP UNTIL END OF VARIABLE---------
'parse for END OF PRODUCT CODE
endcode = InStr(1, Productfile, Search)
'LOOP UNTIL START OF PRODUCT CODE
A = 1
Do Until startcode = "/"
startcode = Mid(Productfile, (endcode - A), 1)
A = A + 1
Loop
'FIND THE PRODUCT CODE USING START AND END VARIABLES
PRODUCTCODE(ARR) = Mid(Productfile, (endcode - (A - 2)), (A - 4))
'SAVE THE PRODUCTCODE IN THE ARRAY
ARR = ARR + 1
ReDim Preserve PRODUCTCODE(ARR)
----------------LOOP UNTIL END OF VARIABLE---------