G
Greg
I am trying to loop through some code to strip out parts of a string that
are in a comma delimited format. I haven't been able to force the order of
evaluation of the Do While statement to give my desired result of looping
until there is no longer a comma delimiter contained in the string.
Here is the code that I am trying to use.
Do While Not (varPos = InStr(StrToParse, ",")) = 0
' Work with first date code
' copy first date code without white spaces
strDateCode = Trim(Left(StrToParse, varPos - 1))
Debug.Print strDateCode;
' strip first date code from the string
StrToParse = Right(StrToParse, Len(StrToParse) - varPos)
Loop
If I put the varPos = InStr(StrToParse, ",") on it's own line it evaluates
to 7 when StrToParse = "X2608 , X3208,X1209" . When I include this in the Do
while not statement below, I can't seem to get the varPos =
InStr(StrToParse, ",") to evaluate to anything but zero no matter how I
place parenthesis.
There may be another way to accomplish the loop (suggestions are welcome),
but I would really like to correct / clarify my understanding of the do
while not loop structure so that I don't need help in the future.
Thank you in advance for any help.
Greg
are in a comma delimited format. I haven't been able to force the order of
evaluation of the Do While statement to give my desired result of looping
until there is no longer a comma delimiter contained in the string.
Here is the code that I am trying to use.
Do While Not (varPos = InStr(StrToParse, ",")) = 0
' Work with first date code
' copy first date code without white spaces
strDateCode = Trim(Left(StrToParse, varPos - 1))
Debug.Print strDateCode;
' strip first date code from the string
StrToParse = Right(StrToParse, Len(StrToParse) - varPos)
Loop
If I put the varPos = InStr(StrToParse, ",") on it's own line it evaluates
to 7 when StrToParse = "X2608 , X3208,X1209" . When I include this in the Do
while not statement below, I can't seem to get the varPos =
InStr(StrToParse, ",") to evaluate to anything but zero no matter how I
place parenthesis.
There may be another way to accomplish the loop (suggestions are welcome),
but I would really like to correct / clarify my understanding of the do
while not loop structure so that I don't need help in the future.
Thank you in advance for any help.
Greg