Differences Between VBScript and VBA
VBScript is a subset of the Visual Basic for Applications language. There are several features that VB and VBA programmers have become accustomed to that are not present in VBScript. This does not lessen the usability of VBScript: it only serves to reinforce that VBScript is meant for scripting and not full-blown client/server application development or COM component development. Let’s take a look at a few of the larger differences between VBScript and VBA:
- VBScript is an untyped language.
Unlike Visual Basic and Visual Basic for Applications, in which the developer can define the data type of a variable in advance, all variables in VBScript are variants. There are subtypes to handle different types of data, and you can use these as you would the traditional data types in Visual Basic. For more information, see Chapter 3.
- VBScript is not compiled.
Although we speak of VBScript code being " compiled” as it is downloaded, VBScript is nevertheless an interpreted language. That means that the code that you write is interpreted into machine language each time you run the script, which imposes a definite performance penalty. Visual Basic programmers who have worked with the language for a long time can remember when Visual Basic was also an interpreted language. Is this a big deal for VBScript? We don’t believe so, since most scripting languages (JavaScript, Perl, Python, etc.) are interpreted rather than compiled. And code portions whose performance ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access