- Calendar constants
- Color constants
- Comparison constants
- Date constants
- Dir, GetAttr, and SetAttr constants
- AppActivate
- Beep
- Call
- ChDir
- ChDrive
- Close
- Const
- Date
- DeleteSetting
- Dim
- Do...Loop
- End
- Enum
- Erase
- Error
- Event
- Exit
- FileCopy
- For Each...Next
- For...Next
- Function
- Get
- GoSub...Return
- GoTo
- If...Then...Else
- Input #
- Kill
- Let
- Line Input #
- Load
- Lock, Unlock
- LSet
- Mid
- MkDir
- Name
- On Error
- On...GoSub, On...GoTo
- Open
- Option Base
- Option Compare
- Option Explicit
- Option Private
- Print #
- Private
- Property Get
- Property Let
- Property Set
- Public
- Put
- RaiseEvent
- Randomize
- ReDim
- Rem
- Reset
- Resume
- RmDir
- RSet
- SaveSetting
- Seek
- Select Case
- SendKeys
- Set
- SetAttr
- Static
- Stop
- Sub
- Time
- Type
- Unload
- While...Wend
- Width #
- With
- Write #
The following constants can be used anywhere in your code in place of the actual values.
VbCalendar The VbCalendar argument has the following values.
| Constant | Value | Description | 
|---|---|---|
| vbCalGreg | 0 | Indicates that the Gregorian calendar is used. | 
| vbCalHijri | 1 | Indicates that the Hijri calendar is used. | 
ColorConstants The ColorConstants argument has the following values.
| Constant | Value | Description | 
|---|---|---|
| vbBlack | 0x0 | Black | 
| vbRed | 0xFF | Red | 
| vbGreen | 0xFF00 | Green | 
| vbYellow | 0xFFFF | Yellow | 
| vbBlue | 0xFF0000 | Blue | 
| vbMagenta | 0xFF00FF | Magenta | 
| vbCyan | 0xFFFF00 | Cyan | 
| vbWhite | 0xFFFFFF | White | 
VbCompareMethod The VbCompareMethod argument has the following values.
| Constant | Value | Description | 
|---|---|---|
| vbUseCompareOption | -1 | Performs a comparison by using the setting of the Option Compare statement. | 
| vbBinaryCompare | 0 | Performs a binary comparison. | 
| vbTextCompare | 1 | Performs a textual comparison. | 
| vbDatabaseCompare | 2 | For Microsoft Access (Windows only), performs a comparison based on information contained in your database. | 
The following constants can be used anywhere in your code in place of the actual values.
VbDayOfWeek The VbDayOfWeek argument has the following values.
| Constant | Value | Description | 
|---|---|---|
| VbUseSystemDayOfWeek | 0 | Use the day of the week specified in your system settings for the first day of the week. | 
| vbSunday | 1 | Sunday (default) | 
| vbMonday | 2 | Monday | 
| vbTuesday | 3 | Tuesday | 
| vbWednesday | 4 | Wednesday | 
| vbThursday | 5 | Thursday | 
| vbFriday | 6 | Friday | 
| vbSaturday | 7 | Saturday | 
VbFirstWeekOfYear The  VbFirstWeekOfYear argument has the following values.
| Constant | Value | Description | 
|---|---|---|
| vbUseSystem | 0 | Use NLS API setting. | 
| VbFirstJan1 | 1 | Start with week in which January 1 occurs (default). | 
| vbFirstFourDays | 2 | Start with the first week that has at least four days in the new year. | 
| vbFirstFullWeek | 3 | Start with the first full week of the year. | 
VbFileAttribute The  VbFileAttribute argument has the following values.
| Constant | Value | Description | 
|---|---|---|
| vbNormal | 0 | Normal (default for Dir and SetAttr) | 
| vbReadOnly | 1 | Read-only | 
| vbHidden | 2 | Hidden | 
| vbSystem | 4 | System file | 
| vbVolume | 8 | Volume label | 
| vbDirectory | 16 | Directory or folder | 
| vbArchive | 32 | File has changed since last backup | 
| vbAlias | 64 | On the Macintosh, identifier is an alias | 
Only VbNormal, vbReadOnly, vbHidden, and vbAlias are available on the Macintosh.
Activates an application window.
AppActivate AppActivate title, [ wait ]Sounds a tone through the computer's speaker.
Beep BeepTransfers control to a Sub procedure, Function procedure, or dynamic-link library (DLL) procedure.
Call [ Call ] name [ argumentlist ]Changes the current directory or folder.
ChDirChDir pathChanges the current drive.
ChDriveChDrive driveConcludes input/output (I/O) to a file opened by using the Open statement.
Close Close [ filenumberlist ]Declares constants for use in place of literal values.
Const[ Public | Private ] Const constname [ As type ] = expressionSets the current system date #mmmm d, yyyy#.
DateDate = dateDeletes a section or key setting from an application's entry in the Windows registry or (on the Macintosh) information in the application's initialization file.
DeleteSetting DeleteSetting appname, section, keyDeclares variables and allocates storage space.
Dim 
Dim WithEventsDim [ WithEvents ] varname [ ( [ subscripts ] ) ] [ As [ New ] type ]Repeats a block of statements while a condition is True or until a condition becomes True.
Do Until Loop
Do While LoopDo [{ While | Until } condition ]
  [ statements ]
  [ Exit Do ]
  [ statements ]
LoopOr,
Do Loop Until
Do Loop WhileDo
  [ statements ]
  [ Exit Do ]
  [ statements ]
Loop [{ While | Until } condition ]Ends a procedure or block.
End
End Function
End If
End Property
End Select
End Sub
End Type
End WithEnd
End Function
End If
End Property
End Select
End Sub
End Type
End WithDeclares a type for an enumeration.
Enum[ Public | Private ] Enum name
  membername [= constantexpression ]
  membername [= constantexpression ] . . .
End EnumReinitializes the elements of fixed-size arrays and releases dynamic-array storage space.
EraseErase arraylistSimulates the occurrence of an error.
Error Error errornumberDeclares a user-defined event.
Event [ Public ] Event procedurename [ (arglist) ]Exits a block of Do…Loop, For…Next, Function, Sub, or Property code.
Exit Do
Exit Fo
Exit Fu
Exit Pr
Exit SuExit Do
Exit For
Exit Function
Exit Property
Exit SubCopies a file.
FileCopyFileCopy source, destinationRepeats a group of statements for each element in an arrays or collection.
For EachFor Each element In group
  [ statements ]
  [ Exit For ]
  [ statements ]
Next [ element ]Repeats a group of statements a specified number of times.
For NextFor counter = start To end [ Step step ]
  [ statements ]
  [ Exit For ]
  [ statements ]
Next [ counter ]Declares the name, arguments, and code that form the body of a Function procedure.
Function
Function Static[Public | Private | Friend] [ Static ] Function name [ ( arglist ) ] [ As type ]
  [ statements ]
  [ name = expression ]
  [ Exit Function ]
  [ statements ]
  [ name = expression ]
End FunctionReads data from an open disk file into a variable.
Get Get [ # ] filenumber, [ recnumber ], varname Branches to and returns from a subroutine within a procedure.
GoSub GoSub line
... line
line ...
ReturnBranches unconditionally to a specified line within a procedure.
GoTo lineGoTo lineConditionally executes a group of statements, depending on the value of an expression.
If If condition Then [ statements ] [ Else elsestatements ]
Or,
If condition Then
  [ statements ]
[ ElseIf condition-n Then
  [ elseifstatements ]]
[ Else
  [ elsestatements ]]
End IfLoads an object but doesn't show it.
LoadLoad objectReads data from an open sequential file and assigns the data to variables.
Input Input #filenumber, varlistDeletes files from a disk.
Kill Kill pathnameAssigns the value of an expression to a variable or property.
Let [ Let ] varname = expressionReads a single line from an open sequential file and assigns it to a String variable.
Line InputLine Input #Controls access by other processes to all or part of a file opened by using the Open statement.
Lock 
Unlock Lock [ # ] filenumber, [ recordrange ]
Unlock [ # ] filenumber, [ recordrange ]Left aligns a string within a string variable, or copies a variable of one user-defined type to another variable of a different user-defined type.
LSetLSet stringvar = string
LSet varname1 = varname2Replaces a specified number of characters in a Variant (String) variable with characters from another string.
MidMid(stringvar, start, [ length ] ) = stringCreates a new directory or folder.
MkDirMkDir pathRenames a disk file, directory, or folder.
Name Name oldpathname As newpathnameEnables an error-handling routine and specifies the location of the routine within a procedure; can also be used to disable an error-handling routine.
On Error Go
On Error ReOn Error GoTo 0
On Error GoTo line
On Error Resume NextBranch to one of several specified lines, depending on the value of an expression.
On GoSub
On GoToOn expression GoSub destinationlist
On expression GoTo destinationlistEnables input/output (I/O) to a file.
Open Open pathname For mode [ Access access ] [ lock ] As [ # ] filenumber [ Len = reclength ]Used at the module level to declare the default lower bound for array subscripts.
Option BaOption Base { 0 | 1 }Used at the module level to declare the default comparison method to use when string data is compared.
Option CoOption Compare { Binary | Text | Database }Used at the module level to force explicit declaration of all variables in that module.
Option ExOption ExplicitWhen used in host applications that allow references across multiple projects, Option Private Module prevents a module's contents from being referenced outside its project. In host applications that don't permit such references, for example, standalone versions of Visual Basic, Option Private has no effect.
Option PrOption Private ModuleWrites display-formatted data to a sequential file.
Print #Print #filenumber, [ outputlist ]Used at the module level to declare private variables and allocate storage space.
Private
Private WithPrivate [ WithEvents ] varname [ ( [ subscripts ] ) ] [ As [ New ] type ]Declares the name, arguments, and code that form the body of a Property procedure, which gets the value of a property.
Property Get
Property Get Static[ Public | Private | Friend ] [ Static ] Property Get name [ (arglist) ] [ As type ]
  [ statements ]
  [ name = expression ]
[ Exit Property ]
  [ statements ]
  [ name = expression ]
End PropertyDeclares the name, arguments, and code that form the body of a Property procedure, which assigns a value to a property.
Property Let
Property Let Static[ Public | Private | Friend ] [ Static ] Property Let name ( [ arglist ], value )
  [ statements ]
  [ Exit Property ]
  [ statements ]
End PropertyDeclares the name, arguments, and code that form the body of a Property procedure, which sets a reference to an object.
Property Set
Property Set Static[ Public | Private | Friend ] [ Static ] Property Set name ( [ arglist ], reference )
  [ statements ]
  [ Exit Property ]
  [ statements ]
End PropertyUsed at the module level to declare public variables and allocate storage space.
Public
Public WithPublic [ WithEvents ] varname [ ( [ subscripts ] ) ] [ As [ New ] type ]Writes data from a variable to a disk file.
Put Put [ # ] filenumber, [ recnumber ], varnameFires an event declared at the module level within a class, form, or document.
RaiseEvent RaiseEvent eventname [ ( argumentlist ) ]Initializes the random-number generator.
Randomize Randomize [ number ]Used at the procedure level to reallocate storage space for dynamic array variables.
ReDim ReDim [ Preserve ] varname ( subscripts )Used to include explanatory remarks in a program.
Rem  Rem commentCloses all disk files opened by using the Open statement.
Reset  ResetRemoves an existing directory or folder.
Resume 
Resume Ne
Resume LiResume [ 0 ]
Resume Next
Resume lineRemoves an existing directory or folder.
RmDirRmDir pathRight aligns a string within a string variable, or copies a variable of one user-defined type to another variable of a different user-defined type.
RSetRSet stringvar = string
RSet varname1 = varname2Saves or creates an application entry in the application's entry in the Windows registry or (on the Macintosh) information in the application's initialization file.
SaveSettingSaveSetting appname, section, key, settingThe root of these registry settings is: Computer\HKEY_CURRENT_USER\Software\VB and VBA Program Settings.
Sets the position for the next read/write operation within a file opened by using the Open statement.
Seek Seek [ # ] filenumber, positionExecutes one of several groups of statements, depending on the value of an expression.
Select CaseSelect Case testexpression
[ Case expressionlist-n
  [ statements-n ]]
[ Case Else 
  [ elsestatements ]]
End SelectSends one or more keystrokes to the active window as if typed at the keyboard.
SendKeysSendKeys [ # ] filenumber, positionAssigns an object reference to a variable or property.
Set Set objectvar = {[ New ] objectexpression | Nothing }Sets attribute information for a file.
SetAttr SetAttr pathname, attributesUsed at the procedure level to declare variables and allocate storage space. Variables declared with the Static statement retain their values as long as the code is running.
StaticStatic varname [ ( [ subscripts ] ) ] [ As [ New ] type ]Suspends execution.
StopStopDeclares the name, arguments, and code that form the body of a Sub procedure.
Sub
Sub Static[ Private | Public | Friend ] [ Static ] Sub name [ ( arglist ) ]
  [ statements ]
  [ Exit Sub ]
  [ statements ]
End SubSets the system time. #hh:mm:ss AM/PM#
Time Time = timeUsed at the module level to define a user-defined data type containing one or more elements.
Type [ Private | Public ] Type varname
  elementname [ ( [ subscripts ] ) ] As type
  [ elementname [ ( [ subscripts ] ) ] As type ] . . .
End TypeRemoves an object from memory.
Unload Unload objectRemoves an object from memory.
While WendWhile condition
  [ statements ]
WendAssigns an output line width to a file opened by using the Open statement.
Width Width #filenumber, widthExecutes a series of statements on a single object or a user-defined type.
WithWith object
  [ statements ]
End WithWrites data to a sequential file.
WriteWrite #filenumber, [ outputlist ]Returns an Integer representing the character code corresponding to the first letter in a string.
AscAsc(string)Returns a String containing the character associated with the specified character code.
ChrChr(charcode)Returns a Variant (String) containing an expression formatted according to instructions contained in a format expression.
FormatFormat(Expression, [ Format ], [ FirstDayOfWeek ], [ FirstWeekOfYear ])Returns a Variant (String) containing an expression formatted according to instructions contained in a format expression.
HexHex(number)Returns a Variant (String) representing the octal value of a number.
OctOct(number)Returns a Variant (String) representation of a number.
StrStr(number)Returns the numbers contained in a string as a numeric value of appropriate type.
ValVal(string)Returns a value of the same type that is passed to it specifying the absolute value of a number.
AbsAbs(number)Returns a Double specifying the arctangent of a number.
AtnAtn(number)Returns a Double specifying the cosine of an angle.
CosCos(number)Returns a Double specifying e (the base of natural logarithms) raised to a power.
ExpExp(number)Returns a Double specifying e (the base of natural logarithms) raised to a power.
Int
FixInt(number)
Fix(number)Returns a Double specifying the natural logarithm of a number.
LogLog(number)Returns a Single containing a pseudo-random number.
RndRnd [ (Number) ]Returns a Variant (Integer) indicating the sign of a number.
SgnSgn(number)Returns a Double specifying the cosine of an angle.
SinSin(number)Returns a Double specifying the sine of an angle.
SqrSqr(number)Returns a Double specifying the tangent of an angle.
Tan Tan (number)- Initial release of MicroBeaut VBA Snippets
- Changed package description
- Revised statements
- Added new statements
- Changed the prefix for,
- Dim WithEvent
- On Error *
- Private WithEvent
- Public WithEvent
 
- Removed statements If...Then..Exitinside,- Do...Loop
- For Each...Next
- For...Next
- Function
- If...Then...Else
 
- Updated descriptions
- Added new statements
- Added Conversion functions
- Added Math functions
- Fixed package not updated
- Added VBA Constants
MIT License
Copyright © 2023 MicroBeaut

