Chapter Builtin Functions and Statements

VBA has a large number of built-in functions and statements. For possible reference, Table 7-1 shows the VBA functions, and Table 7-2 shows the statements. We will take a look at a few of the more commonly used functions and statements for programming Excel VBA in this chapter and Chapter 8.

To help simplify the exposition, we will follow Microsoft's lead and use square brackets to indicate optional parameters. Thus, for instance, the second parameter in the following procedure is optional:

Sub ChangeFormat(FontName [, FontSize])

Note that we have also omitted the data type declarations, which will be discussed separately.

Table 7-1. VBA Functionsm

Abs

DoEvents

IsEmpty

Right

Array

Environ

IsError

RightB

Asc

EOF

IsMissing

Rnd

AscB

Error

IsNull

Round*

AscW

Exp

IsNumeric

RTrim

Atn

FileAttr

IsObject

Second

CallByName*

FileDateTime

Join*

Seek

Cbool

FileLen

Lbound

Sgn

Cbyte

Filter*

Lcase

Shell

Ccur

Fix

Left

Sin

Cdate

Format

LeftB

SLN

CDbl

FormatCurrency*

Len

Space

Cdec

FormatDateTime*

LenB

Spc

Choose

FormatNumber*

LoadPicture

Split*

Chr

FormatPercent*

Loc

Sqr

ChrB

FreeFile

LOF

Str

ChrW

FV

Log

StrComp

Cint

GetAllSettings

Ltrim

StrConv

CLng

GetAttr

Mid

String

Command

GetAutoServerSettings

MidB

StrReverse*

Cos

GetObject

Minute

Switch

CreateObject

GetSetting

MIRR

SYD

CSng

Hex

Month

Tab

CStr

Hour

MonthName*

Tan

CurDir

Iif

MsgBox

Time

Cvar

IMEStatus

Now

Timer

CVDate

Input

Nper

TimeSerial

CVErr

InputB

NPV

TimeValue

Date

InputBox

Oct

Trim

DateAdd

InStr

Partition

TypeName

DateDiff

InStrB

Pmt

DatePart

InstrRev*

PPmt

UCase

DateSerial

Int

PV

Val

Date Value

Ipmt

QBColor

VarType

Day

IRR

Rate

WeekdayWeekdayName *

DDB

IsArray

Replace*

Year

Dir

IsDate

RGB

1' Items marked with an asterisk (*) are for Office 9/10 only.

0 0

Post a comment