The string you passed as an argument to the Execute statement cannot be parsed as a statement. The Execute statement can be used to dynamically execute VBScript code. For example, consider the following VBScript code.

 CopyCode imageCopy Code
Execute "msgbox 1"  'This works because msgbox is a statement.
Execute "5*4"       'This fails because 5*4 cannot be interpreted 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 error in Internet Explorer,

 CopyCode imageCopy Code
<html>
<script language=vbscript>
    5*4
</script>
</html>

Notice that there are two distinct and unrelated Execute statements in VBScript,

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 Also

In Vbsedit, you only need to press F1 to get Help for the keyword under the cursor!


Download Now!



Download   Home  

Copyright © 2001-2024 adersοft