Vba And Excel Object Model Quick Reference

VBA FUNCTION QUICK REFERENCE (CONTINUED)

Interaction Functions

FUNCTION

DESCRIPTION

RETURNS

Choose(index, choice-1, [choice-2,...])

Selects and returns a value from a list of arguments.

Mixed

DoEvents()

Yields execution so the operating system can process other events.

Integer

Iif(expr, truepart, falsepart)

Evaluates the expression and returns either the truepart or falsepart parameter value.

Mixed

InputBox(prompt[, title] [, default] [, xpos] [, ypos] [, helpfile, context])

Displays a dialog box prompting the user for input.

String

GetAllSettings(appname, section)

Returns a list of key settings and their values from the Windows Registry.

Variant

GetObject([pathname][, class])

Returns a reference to an object provided by an ActiveX Component.

Variant

GetSetting(appname, section, key[, default])

Returns a key setting value from an application's entry in the Windows registry.

Variant

MsgBox(prompt[, buttons] [, title] [, helpfile, context])

Displays a message box and returns a value representing the button pressed by the user.

Integer

Partition(number, start, stop, interval)

Indicates where a number occurs within a series of ranges.

String

QBColor(color)

Returns the RGB color code for the specified color.

Long

Switch(expr-1, value-1[, expr-2, value-2 ...])

Evaluates a list of expressions and returns a value associated with the first True expression.

Variant

RGB(red, green, blue)

Returns a number representing the RGB color value.

Long

Mathematical Functions

FUNCTION

DESCRIPTION

RETURNS

Abs (number)

Returns the absolute value of a number.

Mixed

Atn(number)

Returns the arctangent of a number.

Double

Cos(number)

Returns the cosine of an angle.

Double

VBA FUNCTION QUICK REFERENCE (CONTINUED)

Mathematical Functions (Continued)

FUNCTION

DESCRIPTION

RETURNS

Exp (number)

Returns the base of the natural logarithms raised to a power.

Double

Fix(number)

Returns the integer portion of a number. With negative values, returns first negative value greater than or equal to number.

Integer

Int(number)

Returns the integer portion of a number. With negative values, returns the first negative number less than or equal to the number.

Integer

Log(number)

Returns the natural logarithm of a number.

Double

Round(expression [, numdecimalplaces])

Rounds a number to the specified number of decimal places.

Mixed

Rnd[(number)]

Returns a random number between 0 and 1.

Single

Sgn( number)

Returns 1 for a number greater than 0, 0 for a value of 0, and -1 number less than zero.

Integer

Sin(number)

Specifies the sine of an angle.

Double

Sqr(number)

Specifies the square root of a number.

Double

Tan(number)

Specifies the tangent of an angle.

Double

String Manipulation Functions

FUNCTION

DESCRIPTION

RETURNS

nStr([start, ]string1, string2[, compare])

Specifies the position of one string within another string.

Long

InStrRev(stringcheck, stringmatch[, start[, compare]])

Specifies the position of one string within another starting at the end of the string.

Long

LCase(string)

Converts a string to lowercase.

String

Left(string, length)

Returns the specified number of characters from the left side of a string.

String

Len(string | varname)

Determines the number of characters in a string.

Long

LTrim(string)

Trims spaces from the left side of a string.

String

Mid(string, start[, length])

Returns the specified number of characters from the center of a string.

String

Right(string, length)

Returns the specified number of characters from the right side of a string.

String

RTrim(string)

Trims spaces from the right side of a string.

String

Space(number)

Creates a string with the specified number of spaces.

String

0 0

Post a comment