Writing Your First VBScript Code

Initializing the variable gives you a starting point. After its been initialized, you can use the variable in calculations, store it in a database, or display it back to the user in another form. Here is a simple VBScript example:

Dim DateToday
'Initialize the variable
DateToday = Date
MsgBox "Today's date is " &DateToday & "."

Now we have opened up a bit of a can of worms. What's all tat other stuff in the code? We'll look at it line-by-line. The first line is the variable declaration. We've asked the computer to reserve some memory for us, and to please remember the variable name DateToday for us.

First
Next