ChandanD
9 years agoContributor
Compare text in excel
Hi, What I want to do it Enter values until Curve2 as attched in screenshot. I tried to use do loop until (a<>b) but it is not working. I'm unable to compare the value.
Based upon what I'm seeing here, I'm not sure you'll ever break out of the do loop. Since the driver is not moving forward within the loop, you'll always be reading the same row in the Excel file so addnew will always equal name and the loop will just keep going.
Now, I'm pretty amateur in VBScript... but I think you only need the do loop, you don't need the while. So... a quick re-write looks like:
sub test
name="Curve1"
set curvedriver = DDT.ExcelDriver(Path&"TestData\PrjData\PrjData.xlsx", "CurveData", true)
curvedriver.Name="Curvedriver"
do
addnew = DDT.DriverByName("Curvedriver").Value(0)
if (addnew<>name) then Exit do
msgbox(DDT.DriverByName("Curvedriver").Value(1))
msgbox(DDT.DriverByName("Curvedriver").Value(2))
msgbox(DDT.DriverByName("Curvedriver").Value(3))
Call curvedriver.Next()
loop until (curvedriver.EOF)
Call DDT.CloseDriver(curvedriver.Name)
End SubThanks!!!
It is working for me.