VB Language

The following Visual Basic commands have been tested with IDEA v9 and appear to be functioning properly. I have added some examples where possible on their use.


Month(date) Returns a value 1–12 representing the month of the year


There are situations where an object variable does not refer to any object: It refers to nothing, and VBA has the special keyword Nothing to represent this. An object variable contains Nothing when it has been declared but not yet initialized (has not been assigned an object reference).

Finally, you can (and should) explicitly set an object reference to Nothing when you are finished using the object


Returns the system date and time as a type Date.


The Object data type can hold a reference to any object.  Using object any type of object can be referenced while you can reference specific types of objects with they type of object, such as referencing a database as a database object or a task as a task object.


This is used to create a seed value for the Rnd() function, this helps vary the output of the random seed.  You would place a number as the seed, one good option is to use the Second(Now()), this would make sure that your seed is different every time you run the script.


The Rnd() function will calculate a random number between 0 and 1.  You can then multiple it by the top number of the random interval.  So if you wanted a number between 0 and 100 you would multiple it by 100 and also use the Int() function to only capture the integer portion.  In the second example I am looking for a number between 1 and 100, in order to do this I use 99 as the top number and add 1 so that if the random number comes out as 0 it will actually be 1 because I added 1 to it.


The round function will return a specified value to the nearest number, the default value is to the nearest 0, if you wish to the nearest decimal point the function would be Round(number, numer of decimals).  I haven't found a way to round to the nearest tenths or more (one way to get around this is first divide your number by 10, assuming you want to round to the nearest tenths, them do the default round and finally multiply by 10, see the last example).  Also the return value is the same type as the value that is being rounded, so if the number is a double the return value is a


Second(date) Returns a value 0–59 representing the second of the minute


This function will return an indicator of the sign.  If the number is negative it returns -1, if positive it returns 1 and if it is 0 it returns 0.  The return value is an integer type.


The Sin function returns the sine of an angle.  The return value is of type double.