llamositopia
Programmer
I need some help with a Do......Loop that isn't calling a function that I've requested and yet, that function is what would keep the program in a loop. The lines I have indented are not running whatsoever, let alone letting the loop make it's progress. I'm still new to Do....Loops so if someone could help me out that would be great.
start = msgbox ("Would you like to use our stocks program?", vbYesNo)
Do While start = vbYes
name = inputbox ("Enter stock name here. e.g. ""Apple Inc.""")
bprice = inputbox ("Enter price per share when bought here.")
shares = inputbox ("Enter number of shares.")
sprice = inputbox ("Enter sold price here. Enter 0 for not sold.")
bvalue = bprice*shares
svalue = sprice*shares
profit = svalue-bvalue
msgbox("Please open your spreadsheet and click the co-ordinate where you want the data to be entered.")
set a = createobject ("wscript.shell")
wscript.sleep (5000)
a.sendkeys (name)
wscript.sleep (10)
a.sendkeys ("{Tab}")
wscript.sleep (10)
a.sendkeys (bprice)
wscript.sleep (10)
a.sendkeys ("{Tab}")
wscript.sleep (10)
a.sendkeys (shares)
bvalue = bprice*shares
wscript.sleep (10)
a.sendkeys ("{Tab}")
wscript.sleep (10)
a.sendkeys (bvalue)
wscript.sleep (10)
a.sendkeys ("{Tab}")
if sprice = 0 then
a.sendkeys ("{Enter}")
wscript.quit
start = msgbox ("Would you like to continue?", vbYesNo)
else
a.sendkeys (sprice)
wscript.sleep (10)
a.sendkeys ("{Tab}")
wscript.sleep (10)
a.sendkeys (svalue)
wscript.sleep (10)
a.sendkeys ("{Tab}")
wscript.sleep (10)
a.sendkeys (profit)
wscript.sleep (10)
a.sendkeys ("{Enter}")
wscript.quit
start = msgbox ("Would you like to continue?", vbYesNo)
end if
Exit Do
msgbox ("Goodbye.")
Loop
start = msgbox ("Would you like to use our stocks program?", vbYesNo)
Do While start = vbYes
name = inputbox ("Enter stock name here. e.g. ""Apple Inc.""")
bprice = inputbox ("Enter price per share when bought here.")
shares = inputbox ("Enter number of shares.")
sprice = inputbox ("Enter sold price here. Enter 0 for not sold.")
bvalue = bprice*shares
svalue = sprice*shares
profit = svalue-bvalue
msgbox("Please open your spreadsheet and click the co-ordinate where you want the data to be entered.")
set a = createobject ("wscript.shell")
wscript.sleep (5000)
a.sendkeys (name)
wscript.sleep (10)
a.sendkeys ("{Tab}")
wscript.sleep (10)
a.sendkeys (bprice)
wscript.sleep (10)
a.sendkeys ("{Tab}")
wscript.sleep (10)
a.sendkeys (shares)
bvalue = bprice*shares
wscript.sleep (10)
a.sendkeys ("{Tab}")
wscript.sleep (10)
a.sendkeys (bvalue)
wscript.sleep (10)
a.sendkeys ("{Tab}")
if sprice = 0 then
a.sendkeys ("{Enter}")
wscript.quit
start = msgbox ("Would you like to continue?", vbYesNo)
else
a.sendkeys (sprice)
wscript.sleep (10)
a.sendkeys ("{Tab}")
wscript.sleep (10)
a.sendkeys (svalue)
wscript.sleep (10)
a.sendkeys ("{Tab}")
wscript.sleep (10)
a.sendkeys (profit)
wscript.sleep (10)
a.sendkeys ("{Enter}")
wscript.quit
start = msgbox ("Would you like to continue?", vbYesNo)
end if
Exit Do
msgbox ("Goodbye.")
Loop