Learning MicroStation VBA

Chapter 6: Variables

Overview

1 + N + 3 = 7

What is N? N is a variable. In the above equation it represents a number. If we were to solve for N we would get a value of 3.

"Learning MicroStation VBA " & N & " Easy."

What is N? N is a variable. In the above equation it represents a string of characters.

What string of characters does it represent? "IS".

Standard VBA Variable Types

A variable is a name that represents a value or an object. The examples above show variables with a name of N. In one instance the variable holds a numeric value. In the other it holds a string of characters. In general, we know in advance what type of value or object a variable will be representing. Since we know this, we specify what type of variable we will use by declaring it.

Dim N as IntegerN = 7 - 3 - 1

Here, we declare the variable N as an integer. This means it will be a whole number between -32,768 and 32,767.

Dim N As StringN = "IS"MsgBox "Learning MicroStation VBA " & N & " Easy."

Here we declare N as a string. A string is a group of characters. After a variable is assigned a value, you can use it in the place of a number, text, or some other type of value or object.

We will use variables extensively throughout this book. Let's examine some of the more common types...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Metal-Oxide Semiconductor FET (MOSFET)
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.