Microsoft Vbscript Compilation Error Expected Statement
Contents |
- Expected Statement Perhaps instead of 'Expected Statement', 'missing character' would be a better error message. I have noticed with error 800A0400 how
1 1 Microsoft Vbscript Compilation Error Expected Statement
often the problem is at the beginning or the end of vbscript compilation error expected end of statement the line mentioned in the error message. Introduction to Code 800A0400 Error code 800A0400 is a generic 800a0400 expected_statement 80 message when you execute a VBScript. A wild guess, you have missed a command at the beginning of a line. The Symptoms You Get The script does not
Expected Statement End If
execute as you had hoped. Instead you get a message box like this picture: The Cause of Error 800A0400 Your VBScript contain is missing a statement. This is a difficult error to track down. However, the good news is that I have three examples. Most likely you have placed a statement, which is not appropriate for the
Vbscript Expected ')'
logic of your script. For example, extra brackets, or missing command. Note: the clue 'Source: Microsoft VBScript compilation error'. My point is that 'compilation error' and not a 'runtime error', means this is a syntax error in your script. The Solution for Error: Expected statement The Windows Scripting Host gives us two useful clues, firstly, look on Line: 10, do count any remark or empty lines. Secondly, the Char: number 1, is useful in tracing the error. In this case there is something wrong with the Select statement. The line number, as is so often the case, is crucial to solving this error. The problem is that the whole line is gibberish to the VBScript engine. So take another look at each word, punctuation and see if you can spot a simple error. ‡ Example 1 of Error code: 800A0400Missing underscore at the end of the line 7: ' WSHname.vbs' Sample VBScript to check WSH Version' Author Guy Thomas http://computerperformance.co.uk/' Version 2.3 - September 2010 ' ------------------------------------------------
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more vbscript goto about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges
Vbscript Hello World
Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each how to run vbscript in cmd other. Join them; it only takes a minute: Sign up “Expected statement” in an If Then Statement up vote 0 down vote favorite I have a classic asp application, and i need to skip a for loop if the http://www.computerperformance.co.uk/Logon/code/code_800A0400.htm user has chosen to export this report into excel (the for loop paginates the results) i'm trying to skip this, like so: if not wordExport then response.Write "test" for J = 1 to RSList.PageSize end if more code here display all the information from the database.(without pagination since the user has picked "export") if not wordExport then RSList.movenext next end if however, i keep getting the following error: Microsoft VBScript compilation error '800a0400' Expected statement end if http://stackoverflow.com/questions/9318800/expected-statement-in-an-if-then-statement ^ is there something i'm missing??? i don't see it... aaah. help! asp-classic if-statement share|improve this question edited Feb 16 '12 at 20:53 asked Feb 16 '12 at 20:47 Madam Zu Zu 1,765144093 Your question has become a bit of a mess, show us a small but complete example of the code that is failing (without intermediatory commentory) demonstrate the you understand that all For statements should have a corresponding Next and If have both a Then and an End If. This exercise alone will probably highlight the problem to you –AnthonyWJones Feb 16 '12 at 21:26 add a comment| 4 Answers 4 active oldest votes up vote 0 down vote Yes, you don't even have a proper FOR loop to begin with. if not wordExport then response.Write "test" for J = 1 to RSList.PageSize next <----- end if share|improve this answer answered Feb 16 '12 at 20:50 Diodeus 82.5k24115146 question updated –Madam Zu Zu Feb 16 '12 at 20:53 add a comment| up vote 0 down vote are you missing a Next J statement? if not wordExport then response.Write "test" for J = 1 to RSList.PageSize 'Do Something Next J end if share|improve this answer answered Feb 16 '12 at 20:51 Rich Andrews 2,91922143 question updated –Madam Zu Zu Feb 16 '12 at 20:53 add a comment| up vote 0 down vote I t
to dynamically execute VBScript code. For example, consider the following VBScript code. Copy CodeExecute "msgbox http://www.codingforums.com/asp/127525-error-expected-statement.html 1" 'This works because msgbox is a statement. Execute "5*4" 'This fails because 5*4 cannot be interpreted vbscript compilation as a statement. The Expected statement error is also generated during the compilation of any script code that expects a statement, not just by Execute and Eval. For example, the following code causes this vbscript compilation error error in Internet Explorer, Copy Code Notice that there are two distinct and unrelated Execute statements in VBScript, the Execute statement that compiles and executes statements on the fly, the Regular Expression Execute method. To correct this error Confirm that the string being passed to Execute is a statement. If the string you want to evaluate is an expression, use Eval. See AlsoReferenceExecute StatementEval Function
Need Help about VBScript? Download VbsEdit! This package includes VbsEdit 32-bit, VbsEdit 64-bit, HtaEdit 32-bit and HtaEdit 64-bit.The evaluation version never expires. Home Copyright © 2001-2016 AdersoftNew? Today's Posts FAQ Rules Guidelines Search Advanced Search Forum :: Server side development ASP error! Expected statement If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Enjoy an ad free experience by logging in. Not a member yet? Register. Results 1 to 4 of 4 Thread: error! Expected statement Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Rate This Thread Current Rating Excellent Good Average Bad Terrible 11-10-2007,01:38 PM #1 sasha85 View Profile View Forum Posts Regular Coder Join Date Sep 2007 Posts 179 Thanks 4 Thanked 0 Times in 0 Posts error! Expected statement Code: select case hour(DateAdd("h",7,now())) case 7 to 10 response.write "do somehting" case 11 to 12 response.write "do somehting" case 13 to 15 response.write "do somehting" case 16 to 18 response.write "do somehting" case 19 to 20 response.write "do somehting" case 21 to 22 response.write "do somehting" case else response.write "do somehting" end select Microsoft VBScript compilation error '800a0400' Expected statement 2.asp, line 4 case 7 to 10 --------^ what is wrong with this code? By the time u recognize this moment, This moment will be gone. Reply With Quote 11-12-2007,12:58 PM #2 Spudhead View Profile View Forum Posts Senior Coder Join Date Jun 2002 Location London, UK Posts 1,856 Thanks 8 Thanked 110 Times in 109 Posts You can't do that in case statements. VBScript only knows what to is in relation to for loops. If you want to check for multiple conditions, use commas: case 7,8,9,10 You need a VBScript reference. Reply With Quote 05-18-2009,06:42 PM #3 ahjcode View Profile View Forum Posts New to the CF scene Join Date May 2009 Posts 3 Thanks 0 Thanked 0 Times in 0 Posts 'Expected Statement' Error In many of my scripts this error has occured, at or near the end of the script. In the following script it occurs on line 42, character 2. It 'Expected statement'. Can anyone solve the problem or give a code that will cancel it apart from On Error Resume Next/GoTo 0? WScript.Run "Notepad" WScript.Sleep 2000 WshShl.SendKeys "Opening Files..." WshShl.SendKeys "~~" WScript.Sleep 2000