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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RyNiteAdix
    New Member
    • Jun 2013
    • 1

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

    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)


    Code:
    set shell = createobject ("wscript.shell")
    
    ' Specify length of names.
    intMax = inputbox("Length of text")
    
    ' Specify number of names to generate.
    intNum = inputbox("Amount of text")
    
    Dim intMax, iLoop, k, intValue, strChar, strName, intNum
    ' Specify the alphabet of characters to use.
    Const Chars = "abcdefghijklmnopqrstuvwxyz"
    
    If intMax="" Then
    msgbox "Please specify length of names"
    Elseif intNum="" Then
    msgbox "Please specify number of names to be generated"
    End If
    
    Do
    
    Randomize()
    For iLoop = 1 To intNum
        strName = ""
        For k = 1 To intMax
            ' Retrieve random digit between 0 and 25 (26 possible characters).
            intValue = Fix(26 * Rnd())
            ' Convert to character in allowed alphabet.
            strChar = Mid(Chars, intValue + 1, 1)
            ' Build the name.
            strName = strName & strChars
    
        wscript.sendkeys (strname & "{space}")
    
    Next
    
    returnvalue=MsgBox ("Do you want to generate some more text?",36)
    If returnvalue=6 Then
    Msgbox "Ok, Generator will activate again"
    Elseif returnvalue=7 Then
    msgbox "Generator is shutting down"
    wscript.quit
    End IF
    loop
    Last edited by Frinavale; Jun 13 '13, 03:11 PM. Reason: Added code tags, moved the information about the problem to be above the code, and added the error message to the body of the thread
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Is this VB.NET?
    Or is it VBA?
    Or maybe it is VB classic?

    -Frinny
    Last edited by Frinavale; Jun 13 '13, 05:26 PM.

    Comment

    • Rabbit
      Recognized Expert MVP
      • Jan 2007
      • 12517

      #3
      You never close your first for loop.

      Comment

      Working...