Variables and Constants
Assignment |
Let |
Delaration |
Const,  Dim,  Private,  Public,  New,  Static |
Check Data Type |
IsArray( ),  IsDate( ),  IsEmpty( ),  IsError( ),
  IsMissing,  IsNull( ),  IsNumeric( ),  IsObject( ),  TypeName( ),  VarType( ) |
Refer to current object |
Me |
Require explicit variable declarations |
Option Explicit |
Set Default data type |
Deftype |
|
Operators
|
Arithmetic |
^,  - ,  *,  /,  \,  Mod,  +,  & |
Comparison |
=,  < >,  >,  <,  < =,  > =,  Like,  Is |
Logical |
Not,  And,  Or,  Xor,  Eqv,  Imp
|
|
Data Types
|
Convert data type |
CBool( ),  CByte( ),  CCur( ),  CDate( ),  CDbl( ), 
CDec( ),  CInt( ),  CLng( ),  CSng( ),  CStr( ),  CVar( ),  CVErr( ), 
Fix( ),  Int( ) |
Intrinsic data types |
Booleean,  Byte,  Currency,  Date,  Double,
  Integer,  Long,  Object,  Single,  String,  Variant  (Default) |
Verify data types |
IsArray( ),  IsDate( ),  IsEmpty( ),  IsError, 
IsMissing,  IsNull( ),  IsNumeric( ),  IsObject( ) |
|
Math
|
Trigonometric functons |
Atn( ),  Cos( ),  Sin( ),  Tan( ) |
General calculations |
Exp( ),  Log( ),  Sqr |
Generate random numbers |
Randomize,  Rnd( ) |
Get absolute value |
Abs( ) |
Get the sign of an expression |
Sgn( ) |
Perform numeric conversions |
Fix( ),  Int( ),  Round( ) |
|
Strings
|
Compare two Strings |
StrComp( ) |
Convert strings |
StrConv( ) |
Convert case |
Lcase( ),  Ucase( ) |
Create a string of a repeating character |
Space( ),  String( ) |
Data Formatting Functions |
Format( ),  FormatCurrency( ),  FormatDateTime( ),
  FormatNumber( ),  FormatPercent( ),  LSet,  RSet |
Find length of a string |
Len( ),  LenB( ) |
Format a string |
Format( ) |
Justify a string |
LSet,  RSet |
Manipulate Strings |
Filter( ),  InStr( ),  InStrB( ), InStrRev( ),
  Left( ),   LeftB( ),   LTrim( ),  Mid,   Mid( ),  MidB( ),  Right( ),
  RightB( ),  Replace( ),  RTrim( ),  Split( ),  Trim( ) |
Reverse a string |
StrReverse( ) |
Set string comparison Rules |
Option Compare |
Work with ASCII values |
Asc( ),  AscB( ),  AscW( ),  Chr( ),  ChrB( ),
  ChrW( ) |
|
Conversions
|
ASCII value to a character |
Chr( ),  ChrB( ),  ChrW( ) |
Convert case |
LCase( ),  UCase( ) |
Date toserial number |
DateSerial( ),   DateValue( ) |
Decimal to other bases |
Hex( ),  Oct( ) |
Number to a string |
Format( ),  Str( ) |
Conver data type |
CBool( ),  CByte( ),  CCur( ),  CDate( ),  Cdbl( ), 
CDec( ),  CInt( ),  CLng( ),  CSng( ),  CStr( ),  CVar( ),  CVErr( ),  Fix( ),  Int( ), |
Date to day, month, weekday, or year |
Day( ),  Month( ),  MonthName( ),  Weekday( ),
  WeekdayName( ),  Year( ) |
Time to hour, minute, or second |
Hour( ),  Minute( ),  Second( ) |
Character to ASCII value |
Asc( ),   AscB( ),   AscW( ) |
String to a number |
Val( ) |
Time to serial number |
TimeSerial( ),  TimeValue( ) |
|
Dates and Times
|
Get the current date or time |
Date( ),  Now( ),  Time( ),  Timer( ) |
Perform date calculations |
DateAdd( ),  DateDiff( ),  DatePart( ) |
Return a date |
DateSerial( ),  DateValue( ) |
Return a time |
TimeSerial( ),  TimeValue( ) |
Set the date or time |
Date,  Time |
Time a process |
Timer( ) |
|
Financial
|
Calculate depreciation |
DDB( ),  SLN( ),  SYD( ) |
Calculate future value |
FV( ) |
Calculate interest rate |
Rate( ) |
Calculate internal rate of return |
IRR( ),  MIRR( ) |
Calculate number of periods |
NPer( ) |
Calculate payments |
IPmt( ),  Pmt( ),  PPmt( ) |
Calculate value |
NPV( ),   PV( ) |
|
Control Flow
|
Branch |
GoSub...Return,  GoTo,  On Error,
  On...GoSub,  On...GoTo,  |
Exit or halt a program |
DoEvents,  End,  Exit,  Stop |
Loops |
Do...Loop,  For...Next,  For Each...Next, 
While...Wend,  With |
Decisions |
Call,  Function,  Property Get,
  Property Let,  Property Set,  Sub |
|
|
|
Input and Output
|
Access or create a file |
Open |
Close files |
Close,  Reset |
Control output appearance |
Format( ),  Print,  Print #,  Spc,
  Tab,  Width # |
Copy a file |
FileCopy |
Get file information |
EOF( ),  FileAttr( ),  FileDateTime,  FileLen( ),
  FreeFile( ),  Get #,  GetAttr,  Loc( ),  LOF( ),  Seek |
File management |
Dir,  Kill,  Lock,  UnLock,  Name |
Read from a file |
Get,  Input,  Input #,  Line Input # |
Length of a file |
FileLen( ) |
File attributes |
FileAttr( ),  GetAttr,  SetAttr |
Set read-write positionin a file |
Seek |
Write to a file |
Print #,  Put #,  Write # |
Information Display/Request Functions |
InputBox( ),  MsgBox( ) |
|
Arrays
|
Verify an array |
IsArray( ) |
Create an array or Return a Variant |
Array( ) |
Change default lower limit |
Option base |
Declare and initialize an array |
Dim,  Private,  Public,  ReDim,  Static |
Find the limits of an array |
LBound( ),  UBound( ) |
Reinitialize an array |
Erase,  ReDim |
|
Collections
|
Create a collection object |
Collection |
Add an object to a collection |
Add |
Remove an object from a collectioon |
Remove |
Reference an item in a collection |
Item |
|
Computer Directives
|
Define compiler constant |
#Const |
Compile and Control Flow |
Do...Loop,  For...Next,  GoSub...Return,  GoTo,
  IIf( ),  If...Then,   if...Then...Else,  On...GoSub,  On...GoTo,  Select Case,  While...Wend |
|
Directories and Files
|
Change directory of folder |
ChDir |
Change the drive |
ChDrive |
Copy a file |
FileCopy |
Make directory or folder |
MkDir |
Remove directory or foler |
RmDir |
Rename a file, directory, or folder |
Name |
Return current path |
CurDir( ) |
Return file date/time stamp |
FileDateTime( ) |
Return file, directory, label attributes |
GetAttr( ) |
Return file length |
Filelen( ) |
Return file name or volume label |
Dir( ) |
Set attribute information for a file |
SetAttr |
|
Errors
|
Generate Run-time errors |
Clear,  Error,  Raise |
Get error messages |
Error |
Provide error information |
Err |
Return error variant |
CVErr |
Error Trapping and Handling |
On Error,  GoTo,  Resume |
Error type verification |
IsError |
|
Miscellaneous
|
Process pending events |
DoEvents |
Run other programs |
AppActivate,  Shell(),  SendKeys |
Send keystrokes to an application |
SendKeys |
Sound a beep from computer |
Beep |
System |
Environ( ) |
Provide a command-line string |
Command |
Automation |
CreateObject,  GetObject |
Graphics and Color |
LoadPicture( ),  QBColor( ),  RGB( ),  SavePicture |
Variable and Array Declaration |
Const,  Declare,  DefType, 
Dim,  Enum...End Enum,  Erase,  Private,  Public,  ReDim,  Static |
Registry |
DeleteSetting,  GetAllSettings( ),  GetSetting, 
SaveSetting |
Objects |
CreateObject( ),  Event,  For Each...Next,
  GetObject( ),  Load,  Property Get,  Property Let,  Properity Set,
  RaiseEvent,  Set,  UnLoad,  With...End With |
Executes a method of an object or
sets/returns an object property |
CallByName( ) |
Option Statements |
Option Base,  Option Ccmpare,  Option Explicit |
Expression Evaluation |
Switch( ) |
Add comments to code (Ignored by the compiler) preceded with the Remarks Statement or the apostrophe symbol |
Rem,  ' |
Selects and returns a value from a list of arguments |
Choose |
|