What is the difference between VB and VBScript?
-
I'm stripping the Java/JavaScript bit out of your question, as it's irrelevant and duplicates an existing question. For the answer, see: http://stackoverflow.com/questions/245062/whats-the-difference-between-javascript-and-java – Shog9 Sep 05 '09 at 19:15
-
Related post - [What is the difference between vbscript and vb.net?](https://stackoverflow.com/q/3871511/465053) – RBT Feb 20 '19 at 12:11
-
VBA features not in VBScript and VBScript features not in VBA: http://www.csidata.com/custserv/onlinehelp/vbsdocs/vbsfea1.htm – GSerg Jun 10 '19 at 13:20
6 Answers
VB is a full-fledged programming language which can be used to create compiled applications, while VBScript is a sub-set of VB and is a scripting language that can be used to run a set of commands, similar to an old-school DOS batch file. Generally, a scripting language can not be used to create a full-fledged binary application and it can not be compiled down to a executable binary file.

- 28,542
- 5
- 55
- 68
This is a very old question, but existing answers are outrageously vague, and/or fail to identify the most important stuff, when they're not just plain wrong. Not going to repeat what other answers already indicate, but the following differences are missing from the other answers:
Scopes
VBScript code doesn't need procedure scopes: it can be written as a [drumroll] script that just executes a bunch of procedural operations top-to-bottom.
In VB6/VBA executable statements can only exist inside procedure scopes.
Types
In VBScript everything (variables, function return values, etc.) is a Variant
(i.e. pretty much a duck, like in JavaScript). It is illegal to declare an explicit type when declaring a variable. The As
keyword is illegal!
In VB6/VBA everything defaults to an implicit Variant
, but good VB6/VBA code uses explicit types where applicable.

- 69,817
- 8
- 107
- 235
-
1Scopes aren't missing, VBScript still has Global, Class and Procedure scoped variables. Personally, if I'm writing VBScript regardless of whether it can just be written as a strew of commands, I prefer to give it structure. – user692942 May 24 '17 at 22:39
-
3@Lankymart I'm not saying scopes are missing - I'm saying they don't *have to* exist. Which is quite a major difference between it and other flavors, where executable statements *must* be inside a procedure scope. I meant "missing" as in "missing from other answers". – Mathieu Guindon May 24 '17 at 22:41
-
By definition, anything written outside of a procedure or function in VBScript is in the Global scope. – user692942 Oct 28 '20 at 09:48
-
@Lankymart that's 3.5 years later... but yes? The point about scopes remains: VBScript lets you have executable statements *outside of a procedure body*, and VB6/VBA does not, it's a compile-time error to have that. – Mathieu Guindon Oct 28 '20 at 13:43
VBScript is a "lightweight" subset of Visual Basic with limited syntax that is used for scripting purposes (like routine task automation) rather than application development.
While Visual Basic code is compiled into binary executables, VBScript code is interpreted and runs within a host environment (e.g. Windows Script Host or Internet Explorer).

- 87,344
- 17
- 243
- 314
Also VBScript's code can be ran in VB6. Maybe that confuses you.
But all VB6's codes can't be ran in VBScript.

- 628
- 1
- 5
- 18
-
2Wrong. VBScript executable can be written outside of procedure scopes; not in VB6. – Mathieu Guindon May 24 '17 at 21:40
-
@Mat's Mug, What is a "VBScript executable"? (except some hacking where it is embedded in a VB.net wrapper or similar, I know of no such thing), and as for "outside of procedure scopes", assume readers have a brain and just happen not to have come across that term. Please explain (and not in "you are assumed to be a guru mind reader parlance" if that's OK :-). I suspect you mean you can write code in a "module" header like the original QB? – www-0av-Com Dec 17 '17 at 01:16
-
@user1863152 hmm looks like it's missing a word. I meant "executable *statements*", i.e. VBScript code doesn't *require* to be scoped, like VB6 code does - in other words it's not true that VB6 can run any VBS code, at least not without modifications, however small they might need to be. – Mathieu Guindon Dec 17 '17 at 01:20
VB is application development tool (like, desktops, web based application)
And VB script is scripting language, it can not independently developed application.

- 1