VBScript - The features

Ask a question


VBScript is a language that integrate with container applications, called as "Scripting hosts". Thus the container provides an execution environment and a number of objects with which the language can interact.
Moreover, it is possible to use objects other than the ones natively provided by the container: external objects know as ActiveX objects.
The following diagram summarizes this concept:
  • The operating system provides Windows Scripting Host (WSH) container, which in turns provide access to an object named WScript. The WScript object has a number of properties and methods for manipulating files on the system, network connections or printers.
  • Internet Explorer provides a container to manipulate the "document" object, representing the HTML page and all of its components (form elements, images, etc..).


Note that: VBScript programming depends heavily on the container in which it is executed.

Language typology


VBScript is not case sensitive, which means that you can either write your variable names in lowercase or uppercase. However, to ensure some consistency in your scripts, it is advisable to stick to a specific method. The structure of language allows one statement per line of code. Given that the instructions written in VBScript don't end with any specific character, in order for you to write a long statement on multiple lines, it is necessary to use a special character called a "line-continuation character". In VBScript it is a space followed by an underscore. By cons, to write multiple statements on a single line, it is necessary to use a colon (:) to separate instructions ...

How to add comments?


It is possible to use comment in VBScript, that is to say the lines of text to document the script, which will not be interpreted by the ActiveX Scripting. To add comments, just use the comments symbol ('), and all characters that follow this symbol on the same line will not be interpreted.



Dim myVariable 'This is a comment  
'This is a comment too


Original document published on CommentcaMarche.net
Jean-François Pillou

CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jeff Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.

Learn more about the CCM team