By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,168 Members | 2,599 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,168 IT Pros & Developers. It's quick & easy.

VBScript Error 800A040E("loop" without "do" error)

P: 1
There seems to be nothing wrong with the syntax yet it keeps giving me the "loop" without "do" error.

VBScript Error 800A040E("loop" without "do" error)


Expand|Select|Wrap|Line Numbers
  1. set shell = createobject ("wscript.shell")
  2.  
  3. ' Specify length of names.
  4. intMax = inputbox("Length of text")
  5.  
  6. ' Specify number of names to generate.
  7. intNum = inputbox("Amount of text")
  8.  
  9. Dim intMax, iLoop, k, intValue, strChar, strName, intNum
  10. ' Specify the alphabet of characters to use.
  11. Const Chars = "abcdefghijklmnopqrstuvwxyz"
  12.  
  13. If intMax="" Then
  14. msgbox "Please specify length of names"
  15. Elseif intNum="" Then
  16. msgbox "Please specify number of names to be generated"
  17. End If
  18.  
  19. Do
  20.  
  21. Randomize()
  22. For iLoop = 1 To intNum
  23.     strName = ""
  24.     For k = 1 To intMax
  25.         ' Retrieve random digit between 0 and 25 (26 possible characters).
  26.         intValue = Fix(26 * Rnd())
  27.         ' Convert to character in allowed alphabet.
  28.         strChar = Mid(Chars, intValue + 1, 1)
  29.         ' Build the name.
  30.         strName = strName & strChars
  31.  
  32.     wscript.sendkeys (strname & "{space}")
  33.  
  34. Next
  35.  
  36. returnvalue=MsgBox ("Do you want to generate some more text?",36)
  37. If returnvalue=6 Then
  38. Msgbox "Ok, Generator will activate again"
  39. Elseif returnvalue=7 Then
  40. msgbox "Generator is shutting down"
  41. wscript.quit
  42. End IF
  43. loop
Jun 13 '13 #1
Share this Question
Share on Google+
2 Replies


Frinavale
Expert Mod 5K+
P: 9,731
Is this VB.NET?
Or is it VBA?
Or maybe it is VB classic?

-Frinny
Jun 13 '13 #2

Rabbit
Expert Mod 10K+
P: 12,383
You never close your first for loop.
Jun 13 '13 #3

Post your reply

Sign in to post your reply or Sign up for a free account.