Floating point
String variables are used to hold text data. A fixed-length string can be declared to contain anywhere from 1 to about 64,000 characters. To declare a fixed-length string, use the String keyword followed by the * (asterisk) symbol and the desired size.
- Read more about Floating point
- Log in or register to post comments
String
String variables are used to hold text data. A fixed-length string can be declared to contain anywhere from 1 to about 64,000 characters. To declare a fixed-length string, use the String keyword followed by the * (asterisk) symbol and the desired size.
- Read more about String
- Log in or register to post comments
Date
The term date is used to refer to both dates and times. Dates are represented numerically as floating-point numbers. The integer part of the number represents the date as the number of days since December 30, 1899 (with negative numbers for prior dates), and the fractional part of the number represents the time of day as a fraction of the 24-hour day.
- Read more about Date
- Log in or register to post comments
Object
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.
- Read more about Object
- Log in or register to post comments
Boolean
A Boolean variable can hold a True/False value. Boolean variables (and properties) are used frequently in VBA programming to hold data that can be on/off, yes/no, and so on. When you declare a Boolean variable, it is automatically initialized to False.
- Read more about Boolean
- Log in or register to post comments
Variant
Variant is VBA’s most flexible data type as well as the default type. The Variant data type can hold almost any type of data, the exceptions being fixedlength strings and user-defined types. The downside is that Variant data requires more memory to store, and more computer power to process, than other data types.
- Read more about Variant
- Log in or register to post comments
User-Defined Types
A user-defined type (UDT) allows the programmer to define custom data elements that are specifically suited for the data at hand. A UDT can contain two or more elements, each element being a variable or array. UDTs are defined with the Type...End Type statement.
- Read more about User-Defined Types
- Log in or register to post comments
Nothing
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
- Read more about Nothing
- Log in or register to post comments
With...End With
The With...End With construct cannot be called a control statement because it does not modify code execution. It does, however, provide a handy shorthand that simplifies writing code in certain situations.
- Read more about With...End With
- Log in or register to post comments
If...Then Statement
The If...Then statement, or If statement for short, is used in a program to execute a block of code if a specified logical condition is True. If condition is True, the statements in the block (indicated by block1) are executed. If condition is False, they are not executed.
- Read more about If...Then Statement
- Log in or register to post comments