Troubleshooting Code 800A0400 – Expected Statement
Perhaps instead of ‘Expected Statement’, ‘missing character’ would be a better error message. I have noticed with error 800A0400 how often the problem is at the beginning or the end of the line mentioned in the error message.
Introduction to Code 800A0400
Error code 800A0400 is a generic 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 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 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: 800A0400
Missing underscore at the end of the line 7:
‘ WSHname.vbs
‘ Sample VBScript to check WSH Version
‘ Author Guy Thomas https://computerperformance.co.uk/
‘ Version 2.3 – September 2010
‘ ——————————————————-
On Error Resume Next
WScript.Echo «WSH Version: » & WScript.Version & » » & WScript.BuildVersion
& vbcr & «File name: » WScript.ScriptName
WScript.Quit
Solution
Missing underscore at the end of the line:
WScript.Echo «WSH Version: » & WScript.Version & » » & _
‘ WSHname.vbs
‘ Sample VBScript to check WSH Version
‘ Author Guy Thomas https://computerperformance.co.uk/
‘ Version 2.3 – September 2010
‘ ——————————————————-
On Error Resume Next
WScript.Echo «WSH Version: » & WScript.Version & » » & _ WScript.BuildVersion
& vbcr & «File name: » WScript.ScriptName
WScript.Quit
Guy Recommends: A Free Trial of the Network Performance Monitor (NPM)
v11.5
SolarWinds’ Orion performance monitor will help you discover what’s happening on your network. This utility will also guide you through troubleshooting; the dashboard will indicate whether the root cause is a broken link, faulty equipment or resource overload.
What I like best is the way NPM suggests solutions to network problems. Its also has the ability to monitor the health of individual VMware virtual machines. If you are interested in troubleshooting, and creating network maps, then I recommend that you try NPM now.
Download a free trial of Solarwinds’ Network Performance Monitor
Example 2 of 800A0400
Error on Line 4.
Talk about stupid errors, there is no ‘ apostrophe to Rem out that line of dashes.
Actual
————————
Should be:
‘ —————————–
‘The script is below, and the pclist.txt contain only 2 line:
‘ mainsrv
‘ computer1
——————————————————–
Const ForReading = 1
Set objDictionary = CreateObject(«Scripting.Dictionary»)
Set objFSO = CreateObject(«Scripting.FileSystemObject»)
Set objTextFile = objFSO.OpenTextFile _
(«e:\scripts\pclist.txt», ForReading)
i = 0
Do Until objTextFile.AtEndOfStream
strNextLine = objTextFile.Readline
objDictionary.Add i, strNextLine
i = i + 1
Loop
For Each objItem in objDictionary
StrComputer = objDictionary.Item(objItem)
Set objWMIService = GetObject(«winmgmts:» _
& «{impersonationLevel=impersonate}!\\» & strComputer& «\root\cimv2»)
Set colServices = objWMIService.ExecQuery _
(«SELECT * FROM Win32_Service»)
Wscript.Echo strComputer, colServices.Count
Next
Example 3 of 800A0400 (Code available)
I just plain missed command, for example no ‘Set’.
Problem
«Error» ObjNetwork = CreateObject(«Wscript.Network»)
Correction
Set ObjNetwork = CreateObject(«Wscript.Network»)
Guy Recommends: SolarWinds Engineer’s Toolset v10
This Engineer’s Toolset v10 provides a comprehensive console of 50 utilities for troubleshooting computer problems. Guy says it helps me monitor what’s occurring on the network, and each tool teaches me more about how the underlying system operates.
There are so many good gadgets; it’s like having free rein of a sweetshop. Thankfully the utilities are displayed logically: monitoring, network discovery, diagnostic, and Cisco tools. Try the SolarWinds Engineer’s Toolset now!
Download your fully functional trial copy of the Engineer’s Toolset v10
Example 4 – No need for End If
The 800A0400 error message in VBScript often appears when the user adds a «End» statement when there is no need for one. For example, in this script, the user puts «End If», when there is no If statement to end.
MsgBox «Click OK to continue»
Input = InputBox(«Type your name»)
End If
There was no need for the user to put «End If», so the script host says that the user needs to put an ‘If’ statement, but wouldn’t it make much more sense if it told the user to delete the ‘End If’ statement?
This example was kindly sent in by Alex Jones.
Select Case Example of Error Code 800A0400
n_Num = 3
Select Case n_Num
Case n_Num 1
wscript.echo 1
Case 2
wscript.echo 2
Case 3
wscript.echo 3
End Case
Solutions:
Should be Case 1 (Not Case n_Num 1)
Should be End Select (Not End Case)
Kindly sent in by Bradley Harris.
See More Windows Update Error Codes 8004 Series
• Error 800A101A8 Object Required •Error 800A0046 •Error 800A10AD •Error 800A000D
• Error 80048820 •Error 800A0401 •Review of SolarWinds Permissions Monitor
• Error 80040E14 • Error 800A03EA • Error 800A0408 • Error 800A03EE
If you like this page then please share it with your friends
Problem
Microsoft VBScript compilation error ‘800a0400’Expected statement/idmws/Do
Resolving The Problem
Microsoft VBScript compilation error ‘800a0400’
Expected statement
/idmws/DocView.asp, line 179
<!— #INCLUDE FILE=»IncAsps/eFormsDocView.asp» —> To «fix» the problem, simply put an apostrophe in front of the line that reads:
<!— #INCLUDE FILE=»IncAsps/eFormsDocView.asp» —>
The modified section of code will look like:
‘ Start of Panagon eForms integration:
‘ Panagon eForms — 4.2.1.1046
‘<!— #INCLUDE FILE=»IncAsps/eFormsDocView.asp» —>
‘ End Panagon eForms integration
Then, simply save the modified docview.asp page and make sure notepad doesn’t append a .txt extension on the file.
[{«Product»:{«code»:»SS5USE»,»label»:»FileNet IDM Desktop\/WEB Services\/Open Client»},»Business Unit»:{«code»:»BU053″,»label»:»Cloud & Data Platform»},»Component»:»IDM Desktop»,»Platform»:[{«code»:»PF025″,»label»:»Platform Independent»}],»Version»:»3.X»,»Edition»:»»,»Line of Business»:{«code»:»LOB45″,»label»:»Automation»}}]
Historical Number
10003840
Product Synonym
IDM WEB/OPEN CLIENT
Not good in classic ASP. I need to add popUp when clicking on Delete or Recover (x and circled arrow). Here is ASP code without popUp:
i = 0
while not rs.eof
i = i +1
'a.AccountID,a.Deleted,MSPdisabled,MSPppAccountID ,a.Name,a.Description,a.Notes,a.WebSite,at.AccountType
Dict.SetKey = "dataTableRow_" & i
arrValues = split(varValues,",")
j = 0
sDelete = " <a href=/portal3/#ajax-config/?rID=Deleted&ClientID=" & request.querystring("ClientID") & "&type=" & sType & "&Type2=" & varType2 & "&ID=" & rs(trim(varType2)) & varCabinetAction & "&Action=Del"
'if varClientID <> "" then sDelete = sDelete & "&ClientID=" & varClientID
sDelete = sDelete & varRandomString & "><span class=""glyphicon glyphicon-remove"" title=""Delete"" id=""deleteItemFromFolder""></span></a>"
<%
^
response.write("")
%>
sRecover = " <a href=/portal3/#ajax-config/?rID=Deleted&type=" & sType & "&Type2=" & varType2 & "&ID=" & rs(trim(varType2)) & "&Action=Recover"
if varClientID <> "" then sRecover = sRecover & "&ClientID=" & varClientID
sRecover = sRecover & varRandomString & "><span class=""glyphicon glyphicon-repeat"" title=""Recover""></span>"
Dict.SetField j, sDelete & sRecover
for each value in arrValues
j = j +1
'response.write value
Dict.SetField j,rs(value).value
next
Dict.Update
rs.movenext
wend
arrFields = split(langOptions&"," & varFields,",")
sFieldOptions = ""
for each aF in arrFields
if sFieldOptions <> "" then sFieldOptions = sFieldOptions & ","
sFieldOptions = sFieldOptions & "1"'always nowrap
next
arrFieldOptions = split(sFieldOptions,",")'wrap/not wrap
response.write funDataTable(Dict,arrFields,arrFieldOptions,arrOptions)
'END DICTIONARY
Set Dict = Nothing
'######################################################################
else
response.write "<div class=""alert alert-info""><strong>"&langNONETOPURGERECOVER&"</strong></div>"
end if
end if
I tried to add bootstrap coding. Here how it looks like injected:
i = 0
while not rs.eof
i = i +1
'a.AccountID,a.Deleted,MSPdisabled,MSPppAccountID ,a.Name,a.Description,a.Notes,a.WebSite,at.AccountType
Dict.SetKey = "dataTableRow_" & i
arrValues = split(varValues,",")
j = 0
sDelete = " <a href=/portal3/#ajax-config/?rID=Deleted&ClientID=" & request.querystring("ClientID") & "&type=" & sType & "&Type2=" & varType2 & "&ID=" & rs(trim(varType2)) & varCabinetAction & "&Action=Del"
'if varClientID <> "" then sDelete = sDelete & "&ClientID=" & varClientID
sDelete = sDelete & varRandomString & "><span class=""glyphicon glyphicon-remove"" title=""Delete"" id=""deleteItemFromFolder""></span></a>"
sRecover = " <a href=/portal3/#ajax-config/?rID=Deleted&type=" & sType & "&Type2=" & varType2 & "&ID=" & rs(trim(varType2)) & "&Action=Recover"
if varClientID <> "" then sRecover = sRecover & "&ClientID=" & varClientID
sRecover = sRecover & varRandomString & "><span class=""glyphicon glyphicon-repeat"" title=""Recover""></span>"
<%
response.write("
<div class="widget-body no-padding">
<div class="smart-form">
<footer>
<input id="feedbackForDeleteSettings" name=submit value="<%=langResetSettings%>" class="btn btn-primary btn-danger" type=submit data-toggle="modal" data-target="#resetChanges">
<input id="saveCustomTheme" name=submit value="<%=langUpdateAboveSettings%>" class="btn btn-primary" type=submit data-id="userCustomization">
<div class="modal fade" id="submitChanges" tabindex="-1" role="dialog" aria-labelledby="submitChanges" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h5 class="modal-title">You successfully updated the changes!</h5>
</div>
</div>
</div>
</div>
<div class="modal fade" id="deleteItemFromFolder" tabindex="-1" role="dialog" aria-labelledby="deleteItemFromFolder" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h5 class="modal-title">You successfully removed all custom changes.
</br>
Please, reload the page.
</h5>
</div>
</div>
</div>
</div>
</footer>
</div>
</div>
")
%>
Dict.SetField j, sDelete & sRecover
for each value in arrValues
j = j +1
'response.write value
Dict.SetField j,rs(value).value
next
Dict.Update
rs.movenext
wend
arrFields = split(langOptions&"," & varFields,",")
sFieldOptions = ""
for each aF in arrFields
if sFieldOptions <> "" then sFieldOptions = sFieldOptions & ","
sFieldOptions = sFieldOptions & "1"'always nowrap
next
arrFieldOptions = split(sFieldOptions,",")'wrap/not wrap
response.write funDataTable(Dict,arrFields,arrFieldOptions,arrOptions)
'END DICTIONARY
Set Dict = Nothing
'######################################################################
else
response.write "<div class=""alert alert-info""><strong>"&langNONETOPURGERECOVER&"</strong></div>"
end if
end if
But all the time I get «Microsoft VBScript compilation error ‘800a0400’
Expected statement
/portal3/ajax-config/config.asp, line 9697
<%
^
«.
I will be grateful for any help!
Hi,
I am beginer in VB scripting, I tried to use a hello world program in VB but it gives compilation error somebody please help me how to solve this problem.
I use following code
I written this code in notepade and saved as Hello.vbs
<html> <body> <script type="text/vbscript"> document.write("Hello World") </script> </body> </html>
open a notepad & write the following line:
msgbox(«Hello World»)
save it as Hello.vbs, when you double click, this will display the alert box.
check the following VB script tutorial
http://www.w3schools.com/vbscript/default.asp[^]
Mehdi is right, It’ll work only in IE.
However, other web browsers such as Firefox and Opera do not have built-in support for VBScript. This means that where client-side scripting and cross-browser compatibility are required, developers usually choose JavaScript over VBScript.
For details about the particular Error number, see this
Code Error 800A0400 — Expected Statement[^]
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
CodeProject,
20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8
+1 (416) 849-8900
Hello,
I am attempting to do a send an email within an asp page from a submit button however I continue to get Microsoft VBScript compilation (0x800A0400) Expected statement. Any assistance….
Here is the code. — Its an ASP page
<%
Rcpt = zdavidson@testing.com
‘Rcpt = Chr(34) & Requestor_FName & Chr(34) & Requestor_LName & Chr(34) & «<» & Email & «>»
Set objMessage = CreateObject(«CDO.Message»)
objMessage.Subject = «Access Request»
objMessage.From = «»»Reporting»
objMessage.To = Rcpt
objMessage.CC = «zdavidson@testing.com »
objMessage.TextBody = «Please review registation request for testing.»
objMessage.Configuration.Fields.Item _
(«http://schemas.microsoft.com/cdo/configuration/sendusing») = 2
‘Name or IP of Remote SMTP Server objMessage.Configuration.Fields.Item _ («http://schemas.microsoft.com/cdo/configuration/smtpserver») = «123.555.26.4»
‘Server port (typically 25) objMessage.Configuration.Fields.Item _ («http://schemas.microsoft.com/cdo/configuration/smtpserverport») = 25
objMessage.Configuration.Fields.Update ‘==End remote SMTP server configuration section== objMessage.Send End Sub
%>