Abs
AppActivate
Array
Asc
AscB
AscW
Atn
Beep
Bin
Bin$
Calendar
CallByName
CBool
CByte
CCur
CDate
CDbl
CDec
CErr
ChDir
ChDrive
Choose
Chr
Chr$
ChrB
ChrB$
ChrW
ChrW$
CInt
CLng
CLngLng
Close
CObj
Command
Command$
Cos
CreateObject
CSByte
CSng
CStr
CUInt
CULng
CULngLng
CurDir
CurDir$
CVar
CVDate
CVErr
Date
Date$
DateAdd
DateDiff
DatePart
DateSerial
DateTimeSerial
DateValue
Day
DDB
DeleteSetting
Dir
DoEvents
Environ
Environ$
EOF
Error
Error$
Escape
Exp
FileAttr
FileCopy
FileDateTime
FileLen
Filter
Fix
Format
Format$
FormatCurrency
FormatDatetime
FormatNumber
FormatPercent
FreeFile
FV
GetAllSettings
GetAttr
GetObject
GetSetting
Hex
Hex$
Hour
IIf
IMEStatus
Input
Input$
InputB
InputB$
InputBox
InStr
InStrB
InStrRev
Int
IPmt
IRR
IsArray
IsDate
IsEmpty
IsError
IsLeapYear
IsMissing
IsNothing
IsNull
IsNumeric
IsObject
Join
Kill
LBound
LCase
LCase$
Left
Left$
LeftB
LeftB$
Len
LenB
Like
Line Input
Loc
LOF
Log
LTrim
LTrim$
MacID
Mid (function)
Mid$ (function)
MidB (function)
MidB$ (function)
Mid (statement)
Minute
MIRR
MkDir
Month
MonthName
MsgBox
Name
Now
NPer
NPV
ObjPtr
Oct
Oct$
Open
Partition
Pmt
PPmt
Print
Put
PV
QBColor
Randomize
Rate
Replace
Reset
RGB
Right
Right$
RightB
RightB$
RmDir
Rnd
Round
RTrim
RTrim$
SaveSetting
Second
Seek
SendKeys
SetAttr
Sgn
Shell
Sin
SLN
Space
Space$
Spc
Split
Sqr
Str
Str$
StrComp
StrConv
String
String$
StrPtr
StrReverse
Switch
SYD
Tab
Tan
Time
Time$
Timer
TimeSerial
TimeValue
Trim
Trim$
TypeName
UBound
UCase
UCase$
Unescape
Val
VarPtr
VarType
Weekday
WeekdayName
Width
Write
Year
Function Abs
Description Returns the absolute value of a number.
Parameters
Name number
Type Variant
Required? Yes
Use Number whose absolute value will be returned.
Returns Null / same data type as number
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module Math
Since VB 1.0
Example
Debug.Print Abs(True)
 1
Try it
See also Sgn
Sub AppActivate
Description Activates - changes the focus to - a window with the given title.
Parameters
Name title
Type Variant
Required? Yes
Use Title of the window to be activated or the task ID returned by the Shell function.
Name wait
Type Variant/Boolean
Required? No
Use Whether to wait or not until your application has the focus before activating the other window.
Status Not implemented
Module Interaction
Since VB 1.0
Example AppActivate "Untitled - Notepad"
Try it


See also SendKeys, Shell
Function Array
Description Returns an array containing the given parameters as Variants.
Parameters
Name argList
Type ParamArray
Required? No
Use Values to be returned in an array.
Returns An array containing the given parameters in argList.
The lower bound of the array is defined by the Option Base statement.
Errors -
Status Implemented
Module Hidden
Since VB 4.0
Example
Option Base 1
Dim Months
Months = Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
Debug.Print UBound(Months)
 12
Try it
See also
Function Asc
Description Returns the code of the first character of the given string.
Parameters
Name stringValue
Type String
Required? Yes
Use Text from which the code will be returned.
Returns Integer
Errors 5, 13, 91, 450
Status Implemented
Module Strings
Since VB 1.0
Example
Debug.Print Asc("Adam")
 65
Try it
See also AscB, AscW, Chr
Function AscB
Description Returns the first byte of the given string.
Parameters
Name stringValue
Type String
Required? Yes
Use Text from which the byte will be returned.
Returns Byte
Errors 13, 91, 450
Status Implemented
Module Strings
Since VB 4.0
Example
Debug.Print AscB("Adam")
 65
Try it
See also Asc, AscW, Chr
Function AscW
Description Returns the Unicode code of the first character of the given string.
Parameters
Name stringValue
Type String
Required? Yes
Use Text from which the code will be returned.
Returns Integer
Errors 5, 13, 91, 450
Status Implemented
Module Strings
Since VB 5.0
Example
Debug.Print AscW("Adam")
 65
Try it
See also Asc, AscB, Chr
Function Atn
Description Returns the arctangent of a number in radians.
To convert radians to degrees, multiply it by 180 then divide the result by 3.14159265358979.
Parameters
Name number
Type Double
Required? Yes
Use Ratio between the length of the side opposite the angle divided by the length of the angle adjacent to the angle.
Returns Double
Errors 5, 13, 91, 94, 450
Status Implemented
Module Math
Since VB 1.0
Example
Debug.Print Atn(1) * 4
 3.14159265358979
Try it
See also Cos, Sin, Tan
Sub Beep
Description Produces an electronical tone in your computer.
Parameters -
Errors -
Status Implemented
Module Interaction
Since VB 1.0
Example Beep
Try it
See also
Function Bin
Description Returns a string that represents a number's binary value.
Parameters
Name number
Type Variant
Required? Yes
Use Number to be converted to string in binary format.
Returns Variant (Null / String)
Errors 6, 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 1.0
Example
Try it
See also Hex, Oct
Function Bin$
Description Returns a string that represents a number's binary value.
Parameters
Name number
Type Variant
Required? Yes
Use Number to be converted to string in binary format.
Returns String
Errors 6, 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 1.0
Example
Try it
See also Hex, Oct
Property Calendar
Description Specify which calendar to use in your application.
Returns VbCalendar
Errors 5
Status Implemented
Module DateTime
Since VB 6.0
Example
Debug.Print Format(Date, "yyyy-mm-dd")
Calendar = vbCalHijri
Debug.Print Format(Date, "yyyy-mm-dd")
1987-12-30
1408-05-10
Try it
See also
Function CallByName
Description Manipulates an object's properties, or calls its methods using their names.
Parameters
Name objectValue
Type Object
Required? Yes
Use Object that will be manipulated.
Name procName
Type String
Required? Yes
Use Name of the property or method.
Name callType
Type VbCallType
Required? Yes
Use Determines what operation will be performed:
  • vbGet: Retrieves a value from a property Get.
  • vbLet: Assigns a value to a property Let.
  • vbSet: Assigns an object to a property Set.
  • vbMethod: Call an object's method.
Name args
Type ParamArray
Required? No
Use Value to be assigned to the property Let or Set, or arguments to the method.
Returns If the method is a Sub or a property Let or Set, returns Empty, otherwise the retrived value as a Variant.
Errors 5, 13, 91, 450
Status Implemented
Module Interaction
Since VB 6.0
Example
Dim c As New Collection
Debug.Print CallByName(c, "Count", vbGet)
 0
Try it

callType

See also
Function CBool
Description Converts expression to Boolean.
Parameters
Name expression
Type Variant
Required? Yes
Use Value to be converted.
Returns Boolean
Errors 6, 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 4.0
Example
Debug.Print CBool(1)
True
Try it
See also
Function CByte
Description Converts expression to Byte.
Parameters
Name expression
Type Variant
Required? Yes
Use Value to be converted.
Returns Byte
Errors 6, 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 4.0
Example
Debug.Print CByte("42")
 42
Try it
See also
Function CCur
Description Converts expression to Currency.
Parameters
Name expression
Type Variant
Required? Yes
Use Value to be converted.
Returns Currency
Errors 6, 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 1.0
Example
Debug.Print CCur(3.14159)
 3.1416
Try it
See also
Function CDate
Description Converts expression to Date.
Parameters
Name expression
Type Variant
Required? Yes
Use Value to be converted.
Returns Date
Errors 6, 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 4.0
Example
Debug.Print CDate("1987-12-30 01:23:45")
 12/30/1987 01:23:45
Try it
See also
Function CDbl
Description Converts expression to Double.
Parameters
Name expression
Type Variant
Required? Yes
Use Value to be converted.
Returns Double
Errors 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 1.0
Example
Debug.Print CDbl("3.14159")
 3.14159
Try it
See also
Function CDec
Description Converts expression to Decimal.
Parameters
Name expression
Type Variant
Required? Yes
Use Value to be converted.
Returns Decimal
Errors 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 5.0
Example
Debug.Print CDec("-123456789012345678901234.5678")
 -123456789012345678901234.5678
Try it
See also
Function CErr
Description Converts expression to Error.
Parameters
Name expression
Type Variant
Required? Yes
Use Value to be converted.
Returns Error
Errors 91, 94, 450
Status Implemented
Module Conversion
Since VB 4.0
Example
Debug.Print CvErr(42)
Error 42
Try it
See also CVErr, IsError
Sub ChDir
Description Changes the current directory.
Parameters
Name path
Type String
Required? Yes
Use Directory to become the current one.
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Debug.Print CurDir
ChDir "C:\New Dir"
Debug.Print CurDir
C:\Windows\System32
C:\New Dir
Try it
See also ChDrive, CurDir, Dir, MkDir, RmDir
Sub ChDrive
Description Changes the current drive.
Parameters
Name drive
Type String
Required? Yes
Use Drive to become the current one.
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Debug.Print CurDir
ChDrive "D"
Debug.Print CurDir
C:\Windows\System32
D:\
Try it
See also ChDir, CurDir, MkDir, RmDir
Function Choose
Description Returns a value from a list according to index.
Parameters
Name index
Type Single
Required? Yes
Use One-based index to select from choice.
Name choice
Type ParamArray
Required? No
Use List of candidate values.
Returns Value at the index position in the list as a Variant.
If index is lower than 1 or greater than the count of elements in choice,
Null is returned.
Errors 13, 91, 94, 450
Status Implemented
Module Interaction
Since VB 3.0
Example
Debug.Print Choose(2, "eenie", "meanie", "minie", "moe")
meanie
Try it
See also IIf, Switch
Function Chr
Description Returns a character according to the given numeric code in the system's code page.
Parameters
Name charCode
Type Long
Required? Yes
Use Numeric code of the character.
Returns Variant (String)
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module Strings
Since VB 1.0
Example
Debug.Print Chr(65)
A
Try it
See also Asc, Chr$, Str
Function Chr$
Description Returns a character according to the given numeric code in the system's code page.
Parameters
Name charCode
Type Long
Required? Yes
Use Numeric code of the character.
Returns String
Errors 6, 13, 91, 94, 450
Status Implemented
Module Strings
Since VB 1.0
Example
Debug.Print Chr$(65)
A
Try it
See also Asc, Chr, Str
Function ChrB
Description Returns a character according to the given numeric code in the system's code page.
Parameters
Name charCode
Type Byte
Required? Yes
Use Numeric code of the character.
Returns Variant (String)
Status Not implemented
Module Strings
Since VB 4.0
Example
Debug.Print ChrB(65)
A
Try it
See also AscB, ChrB$, Str
Function ChrB$
Description Returns a character according to the given numeric code in the system's code page.
Parameters
Name charCode
Type Byte
Required? Yes
Use Numeric code of the character.
Returns String
Status Not implemented
Module Strings
Since VB 4.0
Example
Debug.Print ChrB$(65)
A
Try it
See also AscB, ChrB, Str
Function ChrW
Description Returns an Unicode character according to the given numeric code.
Parameters
Name charCode
Type Long
Required? Yes
Use Numeric code of the character.
Returns Variant (String)
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module Strings
Since VB 5.0
Example
Debug.Print ChrW(65)
A
Try it
See also AscW, ChrW$, Str
Function ChrW$
Description Returns an Unicode character according to the given numeric code.
Parameters
Name charCode
Type Long
Required? Yes
Use Numeric code of the character.
Returns String
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module Strings
Since VB 5.0
Example
Debug.Print ChrW$(65)
A
Try it
See also AscW, ChrW, Str
Function CInt
Description Converts expression to Integer.
Parameters
Name expression
Type Variant
Required? Yes
Use Value to be converted.
Returns Integer
Errors 6, 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 1.0
Example
Debug.Print CInt(3.14159)
 3
Try it
See also
Function CLng
Description Converts expression to Long.
Parameters
Name expression
Type Variant
Required? Yes
Use Value to be converted.
Returns Long
Errors 6, 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 1.0
Example
Debug.Print CLng(1.5)
 2
Try it
See also
Function CLngLng
Description Converts expression to LongLong.
Parameters
Name expression
Type Variant
Required? Yes
Use Value to be converted.
Returns LongLong
Errors 6, 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 6.7
Example
Debug.Print CLngLng("9000000000000000000")
 9000000000000000000
Try it
See also
Statement Close
Description Closes the given file handlers, or all open files if none is provided.
Parameters
Name fileNumberList
Type ParamArray
Required? No
Use List of file handlers to be closed.
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Try it
See also Open, Reset
Function CObj
Description Converts expression to Object.
Parameters
Name expression
Type Variant
Required? Yes
Use Value to be converted.
Returns Object
Errors 6, 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 1.0
Example
Debug.Print CLng(1.5)
 2
Try it
See also
Function Command
Description Returns the command line arguments given when the application was started.
Parameters -
Returns Variant (String)
Errors 450
Status Implemented
Module Interaction
Since VB 1.0
Example
Debug.Print Command
/c
Try it
See also Command$
Function Command$
Description Returns the command line arguments given when the application was started.
Parameters -
Returns String
Errors 450
Status Implemented
Module Interaction
Since VB 1.0
Example
Debug.Print Command$
/c
Try it
See also Command
Function Cos
Description Returns the cosine of an angle.
Parameters
Name number
Type Double
Required? Yes
Use Angle in radians.
To convert degrees to radians, multiply degrees by 3.14159265358979, then divide by 180.
Returns Double
Errors 5, 13, 91, 94, 450
Status Implemented
Module Math
Since VB 1.0
Example
Debug.Print Cos(3.14159265358979)
 -1
Try it
See also Atn, Sin, Tan
Function CreateObject
Description Instantiates an ActiveX object.
Parameters
Name className
Type String
Required? Yes
Use ProgID of the object to be instanciated.
Name serverName
Type String
Required? No
Use Server from which the object will be instantiated.
Returns Variant (Object)
Status Not implemented
Module Interaction
Since VB 3.0
Example
Dim fs As Object
Set fs = CreateObject("Scripting.FileSystemObject")
Debug.Print TypeName(fs)
FileSystemObject
Try it
See also GetObject
Function CSByte
Description Converts expression to SByte.
Parameters
Name expression
Type Variant
Required? Yes
Use Value to be converted.
Returns SByte
Errors 6, 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 6.7
Example
Debug.Print CSByte("42")
 42
Try it
See also
Function CSng
Description Converts expression to Single.
Parameters
Name expression
Type Variant
Required? Yes
Use Value to be converted.
Returns Single
Errors 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 1.0
Example
Debug.Print CSng("1.5")
 1.5
Try it
See also
Function CStr
Description Converts expression to String.
Parameters
Name expression
Type Variant
Required? Yes
Use Value to be converted.
Returns String
Errors 13, 91, 450
Status Implemented
Module Conversion
Since VB 2.0
Example
Debug.Print CStr(#1987-12-30#)
12/30/1987
Try it
See also
Function CUInt
Description Converts expression to UInteger.
Parameters
Name expression
Type Variant
Required? Yes
Use Value to be converted.
Returns UInteger
Errors 6, 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 6.7
Example
Debug.Print CUInt(3.14159)
 3
Try it
See also
Function CULng
Description Converts expression to ULong.
Parameters
Name expression
Type Variant
Required? Yes
Use Value to be converted.
Returns ULong
Errors 6, 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 6.7
Example
Debug.Print CULng(1.5)
 2
Try it
See also
Function CULngLng
Description Converts expression to ULongLong.
Parameters
Name expression
Type Variant
Required? Yes
Use Value to be converted.
Returns ULongLong
Errors 6, 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 6.7
Example
Debug.Print CULngLng("9000000000000000000")
 9000000000000000000
Try it
See also
Function CurDir
Description Returns the current directory for the given drive.
Parameters
Name drive
Type Variant (String)
Required? No
Use Drive for which to return the current directory.
If no drive is provided, CurDir returns the current directory for the current drive.
Returns Variant (String)
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Debug.Print CurDir("D")
D:\
Try it
See also ChDir, ChDrive, MkDir, RmDir
Function CurDir$
Description Returns the current directory for the given drive.
Parameters
Name drive
Type Variant (String)
Required? No
Use Drive for which to return the current directory.
If no drive is provided, CurDir returns the current directory for the current drive.
Returns String
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Debug.Print CurDir("D")
D:\
Try it
See also ChDir, ChDrive, MkDir, RmDir
Function CVar
Description Converts expression to Variant.
Parameters
Name expression
Type Variant
Required? Yes
Use Value to be converted.
Returns Variant
Errors 450
Status Implemented
Module Conversion
Since VB 2.0
Example
Debug.Print CVar(-1)
-1
Try it
See also
Function CVDate
Description Converts expression to Date.
Parameters
Name expression
Type Variant
Required? Yes
Use Value to be converted.
Returns Variant (Null / Date)
Errors 6, 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 2.0
Example
Debug.Print CDate("1987-12-30 01:23:45")
 12/30/1987 01:23:45
Try it
See also
Function CVErr
Description Converts expression to Error.
Parameters
Name expression
Type Any expression that is an integer or can be converted to one.
Required? Yes
Use Value to be converted.
Returns Variant (Error)
Errors 91, 94, 450
Status Implemented
Module Conversion
Since VB 4.0
Example
Debug.Print CvErr(42)
Error 42
Try it
See also CErr, IsError
Property Date
Description Returns or sets system's date.
Parameters -
Returns Variant (Date)
Errors 6, 13, 91, 94, 450
Status Implemented
Module DateTime
Since VB 1.0
Example
Debug.Print Date
01/23/2022
Try it
See also Date$, Format, Now, Time
Property Date$
Description Returns or sets system's date.
Parameters -
Returns String
Errors 6, 13, 91, 94, 450
Status Implemented
Module DateTime
Since VB 1.0
Example
Debug.Print Date$
01/23/2022
Try it
See also Date, Format, Now, Time
Function DateAdd
Description Returns a Variant with a date to which a time interval has been added.
Parameters
Name interval
Type String
Required? Yes
Use The interval to add.

yyyy Year
q Quarter / three months
m Month
y, d, w Day
ww Week
h Hour
n Minute
s Second
Name number
Type Double
Required? Yes
Use How much of intervals to add to date.
Name date
Type Variant
Required? Yes
Use The date to be added.
Returns Variant (Null / Date)
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module DateTime
Since VB 3.0
Example
Debug.Print DateAdd("d", -1, #1987-12-30#)
12/29/1987
Try it



See also DateDiff, DatePart, Day, Format, Now, Weekday, Year,
Function DateDiff
Description Returns the difference between two dates.
Parameters
Name interval
Type String
Required? Yes
Use The resulting interval.

yyyy Year
q Quarter / three months
m Month
d, y Day
w Weekday
ww Week
h Hour
n Minute
s Second
Name date1
Type Variant
Required? Yes
Use This is the subtrahend date.
Name date2
Type Variant
Required? Yes
Use This is the minuend date.
Name firstDayOfWeek
Type VbDayOfWeek
Required? No
Use Sets what is the first day of the week. It affects the 'w' setting.
Name firstWeekOfYear
Type VbFirstWeekOfYear
Required? No
Use Sets what is the first week of the year. It affects the 'w' and 'ww' settings.
Returns Variant (Null / Long)
Errors 5, 13, 91, 450
Status Implemented
Module DateTime
Since VB 3.0
Example
Debug.Print DateDiff("yyyy", #2001-01-01#, #2000-12-31#)
 -1
Try it





See also DateAdd, DatePart, Day, Format, Now, Weekday, Year
Function DatePart
Description Extracts a part of a date, like its day, month, year, etc.
Parameters
Name interval
Type String
Required? Yes
Use Defines the part of interest.

yyyy Year
q Quarter / three months
m Month
d Day
y Day of year
w Weekday
ww Week
h Hour
n Minute
s Second
Name dateValue
Type Variant
Required? Yes
Use The date whose part will be extracted.
Name firstDayOfWeek
Type VbDayOfWeek
Required? No
Use Sets what is the first day of the week. It affects the 'w' setting.
Name firstWeekOfYear
Type VbFirstWeekOfYear
Required? No
Use Sets what is the first week of the year. It affects the 'w' and 'ww' settings.
Returns Variant (Null / Integer)
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module DateTime
Since VB 3.0
Example
Debug.Print DatePart("w", #2000-01-01#)
 7
Try it




See also DateAdd, DateDiff, Day, Format, Now, Weekday, Year
Function DateSerial
Description Builds a date from the given year, month, and day.
Parameters
Name year
Type Integer
Required? Yes
Use The year part.
Name month
Type Integer
Required? Yes
Use The month part.
Name day
Type Integer
Required? Yes
Use The day part.
Returns Variant (Date)
Errors 6, 13, 91, 94, 450
Status Implemented
Module DateTime
Since VB 1.0
Example
Debug.Print DateSerial(1987, 12, 30)
12/30/1987
Try it
See also Date, DateValue, Day, Month, Now, TimeSerial, TimeValue, Weekday, Year
Function DateTimeSerial
Description Builds a date from the given year, month, day, hours, minutes, and seconds.
Parameters
Name year
Type Integer
Required? Yes
Use The year part.
Name month
Type Integer
Required? Yes
Use The month part.
Name day
Type Integer
Required? Yes
Use The day part.
Name hour
Type Integer
Required? Yes
Use The hour part.
Name minute
Type Integer
Required? Yes
Use The minute part.
Name second
Type Integer
Required? Yes
Use The second part.
Returns Variant (Date)
Errors 6, 13, 91, 94, 450
Status Implemented
Module DateTime
Since VB 6.7
Example
Debug.Print DateSerial(1987, 12, 30, 1, 23, 45)
12/30/1987 1:23:45
Try it






See also Date, DateValue, Day, Month, Now, TimeSerial, TimeValue, Weekday, Year
Function DateValue
Description Converts a string to a date.
Parameters
Name value
Type String
Required? Yes
Use The string to be converted.
Returns Variant (Date)
Errors 13, 94, 450
Status Implemented
Module DateTime
Since VB 1.0
Example
Debug.Print DateValue("Apr 05")
04/05/2022
Try it
See also Date, DateSerial, Day, Month, Now, TimeSerial, TimeValue, Weekday, Year
Function Day
Description Returns an integer number that represents the weekday of the given date.
Parameters
Name dateValue
Type Variant
Required? Yes
Use Date from which the day part will be extracted.
Returns Variant (Null / Integer)
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module DateTime
Since VB 1.0
Example
Try it
See also Date, Hour, Minute, Month, Now, Second, Weekday, Year
Function DDB
Description Returns the asset's double-declining balance depreciation for a given period.
Parameters
Name cost
Type Double
Required? Yes
Use The initial cost of the asset.
Name salvage
Type Double
Required? Yes
Use How much the asset will worth at the end of its life.
Name life
Type Double
Required? Yes
Use Length of the life of the asset.
Name period
Type Double
Required? Yes
Use Period of the depreciation for the calculation.
Both life and period must be expressed in the same unit, like months.
Name factor
Type Variant
Required? No
Default 2
Use Rate at which the balance declines.
Returns Double
Errors 5, 13, 91, 94, 450
Status Implemented
Module Financial
Since VB 3.0
Example
Try it





See also FV, IPmt, IRR, MIRR, NPer, NPV, Pmt, PPmt, PV, Rate, SLN, SYD>
Sub DeleteSetting
Description Removes a section or key setting from the Registry for an application.
Parameters
Name appName
Type String
Required? Yes
Use Name of the application for which this setting applies.
Name section
Type Variant
Required? No
Use Name of the section from where to delete the setting.
Name key
Type Variant
Required? No
Use Name of the key to be deleted.
If not provided, the whole section is deleted.
Status Not implemented
Module Interaction
Since VB 4.0
Example
Try it



See also GetAllSettings, GetSetting, SaveSetting
Function Dir
Description Finds a matching file, directory, or folder name and returns it.
Parameters
Name pathName
Type Variant
Required? No
Use Pattern to be used when looking up a file or directory name.
Name attributes
Type VbFileAttribute
Required? No
Use Attributes to filter the result.
Returns String
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Try it
attributes

See also ChDir, CurDir
Function DoEvents
Description Allows the operating system to process additional events by yielding execution.
Parameters -
Returns Integer
Status Not implemented
Module Interaction
Since VB 1.0
Example
Try it
See also SendKeys
Function Environ
Description Returns the value of a string that has been set to a variable in the environment.
Parameters
Name expression
Type Variant (String / number)
Required? Yes
Use Name of the environment variable whose value will be returned, or its numeric order in the environment starting at 1.
Returns Variant (String)
Status Not implemented
Module Interaction
Since VB 1.0
Example
Try it
See also
Function Environ$
Description Returns the value of a string that has been set to a variable in the environment.
Parameters
Name expression
Type Variant (String / number)
Required? Yes
Use Name of the environment variable whose value will be returned, or its numeric order in the environment starting at 1.
Returns String
Status Not implemented
Module Interaction
Since VB 1.0
Example
Try it
See also
Function EOF
Description Returns a value indicating whether or not a file's end has been reached.
Parameters
Name fileNumber
Type Integer
Required? Yes
Use File handler to be queried about the current read or write position.
Returns Boolean
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Try it
See also Loc, LOF, Open
Function Error
Description Returns the message associated with a given number in the range 0 to 65535.
Parameters
Name errorNumber
Type Variant (UInteger)
Required? No
Use Error number from which the error message will be retrieved.
Returns Variant (String)
Errors 6, 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 1.0
Example
Try it
See also
Function Error$
Description Returns the message associated with a given number in the range 0 to 65535.
Parameters
Name errorNumber
Type Variant (UInteger)
Required? No
Use Error number from which the error message will be retrieved.
Returns String
Errors 6, 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 1.0
Example
Try it
See also
Function Escape
Description Converts any non-ASCII character in a string
to its heaxadecimal number preceded by '%'.
Parameters
Name charString
Type String
Required? Yes
Use String to be converted.
Returns String
Errors 450
Status Implemented
Module Strings
Since VB 6.7
Example
Debug.Print Escape("a <> b")
a%20%3C%3E%20b
Try it
See also Unescape
Function Exp
Description Returns Euler's number raised to the given number.
Parameters
Name number
Type Double
Required? Yes
Use Number used as power to raise e.
Returns Double
Errors 5, 450
Status Implemented
Module Math
Since VB 1.0
Example
Try it
See also Log
Function FileAttr
Description Returns the mode used when opening the file represented by the given handler:
1 - Input
2 - Output
4 - Random
8 - Append
32 - Binary
Parameters
Name fileNumber
Type Integer
Required? Yes
Use File handler used to query the file mode.
Name returnType
Type Integer
Required? No
Default 1
Use Deprecated.
Returns Long
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Try it


See also GetAttr, Open, SetAttr
Sub FileCopy
Description Creates a copy of a file.
Parameters
Name source
Type String
Required? Yes
Use File path to be copied.
Name destination
Type String
Required? Yes
Use File path for the copied file.
Status Not implemented
Module FileSystem
Since VB 2.0
Example
Try it


See also Kill, Name
Function FileDateTime
Description Returns the date and time of the last modification of a file.
Parameters
Name pathName
Type String
Required? Yes
Use File path from which to retrieve date and time of last modification.
Returns Variant (Date)
Status Not implemented
Module FileSystem
Since VB 2.0
Example
Try it
See also FileLen, GetAttr, VarType
Function FileLen
Description Returns the length a file occupies in hard drive measured in bytes.
Parameters
Name pathName
Type String
Required? Yes
Use File path from which to retrieve its length.
Returns Long
Status Not implemented
Module FileSystem
Since VB 2.0
Example
Try it
See also FileDateTime, GetAttr, LOF
Function Filter
Description Filters an array of strings returning a new array containing the matches.
Parameters
Name sourceArray
Type Variant
Required? Yes
Use Onde-dimension array to be filtered.
Name match
Type String
Required? Yes
Use String to search for.
Name include
Type Boolean
Required? No
Default True
Use Whether to return elements containg value or those not containing it.
Name compare
Type VbCompareMethod
Required? No
Default vbBinaryCompare
Use Whether the comparison should be case sensitive or not.
Returns Variant
Errors 6, 13, 91, 94, 450
Status Implemented
Module Strings
Since VB 6.0
Example
Try it




See also Replace
Function Fix
Description Discards the fractionary part of a number returning it as an integer.
Rounding is done in towards zero fashion.
Parameters
Name number
Type Variant
Required? Yes
Use Number to be rounded towards zero.
Returns Variant (Null / same type as number))
Errors 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 6.0
Example
Try it
See also Int, Round
Function Format
Description Takes a number, a date, or a string and formats it according to the given pattern.
Parameters
Name expression
Type Variant
Required? Yes
Use Value to be formatted.
Name fmt
Type Variant (String)
Required? No
Use Takes a number, a date, or a string and formats it according to the given pattern
For strings, it can have up to two semi-colon separated sections:
  1. Deals with regular strings.
  2. Deals with null and zero-length strings.
Format specifiers
@ Outputs a character or a space if there are no more characters left to be consumed by the function.
& Outputs a character or nothing at all.
< Converts to lower case.
> Converts to upper case.
! Fills the specifiers taking characters from right to left, instead of the default left to right.

For numbers, it can have up to four sections:
  1. Deals with positive values.
  2. Deals with negative values.
  3. Deals with zero.
  4. Deals with null.
Named formats
General Number:
Currency:
Fixed:
Standard:
Percent:
Scientific:
Yes/No:
True/False:
On/Off:

Format specifiers
0 Outputs a numeric digit or zero when all digits have been consumed.
# Outputs a numeric digit or nothing when all digits have been consumed.
. Decimal separator.
% The number is multiplied by 100 and the percent characted is added.
, Thousands separator.
E-, e-, E+, e+ Scientific format.
-, +, $, (, ) Those characters are output as is.
\ Escapes the next character.
"" Outputs verbatim the enclosed text.

For dates:
Named formats
General Date
Long Date
Medium Date
Short Date
Long Time
Medium Time
Short Time

Format specifiers
: Time separator.
/ Date separator.
c Same as ddddd if there's no time part, ttttt if there's no date part, or ddddd ttttt if both are present.
d Day of month.
dd Day of month with two digits.
ddd Abbreviated name of the day of the week.
dddd Day of the week.
ddddd Short date format: m/d/yy.
dddddd Long date format: mmmm dd, yyyy.
w Day of the week as number. 1 is Sunday.
ww Week of the year.
m Month.
mm Month with two digits.
mmm Abbreviated name of the month.
mmmm Full name of the month.
q Quarter.
y Day of the year.
yy Year with two digits.
yyyy Year with four digits.
h Hour.
hh Hour with two digits.
n Minutes.
nn Minutes with two digits.
s Seconds.
ss Seconds with two digits.
ttttt Same as h:mm:ss.
AM/PM Uses the twelve-hour clock and display AM or PM accordingly.
am/pm Uses the twelve-hour clock and display am or pm accordingly.
A/P Uses the twelve-hour clock and display A or P accordingly.
a/p Uses the twelve-hour clock and display a or p accordingly.
AMPM Uses the twelve-hour clock and display whatever is configured to your system to AM and PM.
Name firstDayOfWeek
Type VbDayOfWeek
Required? No
Default vbSunday
Use Sets what is the first day of the week. It affects the 'w' specifier.
Name firstWeekOfYear
Type VbFirstWeekOfYear
Required? No
Default vbFirstJan1
Use Sets what is the first week of the year. It affects the 'w' and 'ww' specifiers.
Returns Variant (String)
Errors 5, 13, 91, 450
Status Implemented
Module Strings
Since VB 1.0
Example
Try it
firstDayOfWeek
firstWeekOfYear

See also Str
Function Format$
Description Takes a number, a date, or a string and formats it according to the given pattern.
Parameters
Name expression
Type Variant
Required? Yes
Use
Name fmt
Type String
Required? No
Use
Name firstDayOfWeek
Type VbDayOfWeek
Required? No
Default vbSunday
Use Sets what is the first day of the week.
Name firstWeekOfYear
Type VbFirstWeekOfYear
Required? No
Default vbFirstJan1
Use
Returns Variant (String)
Errors 5, 13, 91, 450
Status Implemented
Module Strings
Since VB 1.0
Example
Try it
firstDayOfWeek
firstWeekOfYear

See also Str
Function FormatCurrency
Description Takes a number and formats it to currency.
Parameters
Name expression
Type Variant
Required? Yes
Use Numeric expression to be formated.
Name numDigitsAfterDecimal
Type Long
Required? No
Use Number of decimal places.
Name includeLeadingDigit
Type VbTriState
Required? No
Default vbUseDefault
Use Whether to include a '0' digit if the number is zero or starts with a zero.
Name useParensForNegativeNumbers
Type VbTriState
Required? No
Default vbUseDefault
Use Whether to use parenthesis or the minus sign to indicate a negative number.
Name groupDigits
Type VbTriState
Required? No
Default vbUseDefault
Use Whether to use thousand separators or not.
Returns String
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module Strings
Since VB 6.0
Example
Try it
includeLeadingDigit
useParensForNegativeNumbers
groupDigits

See also FormatDateTime, FormatNumber, FormatPercent
Function FormatDateTime
Description Takes a date and formats it according to namedFormat.
Parameters
Name expression
Type Variant
Required? Yes
Use Date to be formated.
Name namedFormat
Type VbDateTimeFormat
Required? No
Use Named format to be used to format expression.
Returns String
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module Strings
Since VB 6.0
Example
Try it
namedFormat

See also FormatCurrency, FormatNumber, FormatPercent
Function FormatNumber
Description Takes a number or a string and formats it to number.
Parameters
Name expression
Type Variant
Required? Yes
Use Numeric expression to be formated.
Name numDigitsAfterDecimal
Type Long
Required? No
Use Number of decimal places.
Name includeLeadingDigit
Type VbTriState
Required? No
Default vbUseDefault
Use Whether to include a '0' digit if the number is zero or starts with a zero.
Name useParensForNegativeNumbers
Type VbTriState
Required? No
Default vbUseDefault
Use Whether to use parenthesis or the minus sign to indicate a negative number.
Name groupDigits
Type VbTriState
Required? No
Default vbUseDefault
Use Whether to use thousand separators or not.
Returns String
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module Strings
Since VB 6.0
Example
Try it
includeLeadingDigit
useParensForNegativeNumbers
groupDigits

See also FormatCurrency, FormatDateTime, FormatPercent
Function FormatPercent
Description Takes a number or a string and formats it to percent.
Parameters
Name expression
Type Variant
Required? Yes
Use Numeric expression to be formated.
Name numDigitsAfterDecimal
Type Long
Required? No
Use Number of decimal places.
Name includeLeadingDigit
Type VbTriState
Required? No
Default vbUseDefault
Use Whether to include a '0' digit if the number is zero or starts with a zero.
Name useParensForNegativeNumbers
Type VbTriState
Required? No
Default vbUseDefault
Use Whether to use parenthesis or the minus sign to indicate a negative number.
Name groupDigits
Type VbTriState
Required? No
Default vbUseDefault
Use Whether to use thousand separators or not.
Returns String
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module Strings
Since VB 6.0
Example
Try it
includeLeadingDigit
useParensForNegativeNumbers
groupDigits

See also FormatCurrency, FormatDateTime, FormatNumber
Function FreeFile
Description Returns the next available file number that can be used by Open.
Parameters
Name rangeNumber
Type Variant (Integer)
Required? No
Use When zero, FreeFile returns a number within the 0 - 255 range. When different from zero, the result is withing the 256 - 511 range.
Returns Integer
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Try it
See also Open
Function FV
Description Returns the value of an annuity in the future.
Parameters
Name rate
Type Double
Required? Yes
Use Interest rate per period.
Name nPer
Type Double
Required? Yes
Use Total number of payment periods in the annuity.
Name pmt
Type Double
Required? Yes
Use Payment made each period. Cash paid must be provided as negative numbers, received as positive numbers.
Name pv
Type Variant (Double)
Required? No
Default 0
Use Present value.
Name due
Type Variant (Boolean)
Required? No
Default False
Use Specify when payments are due. True if at the beginning of the period, False otherwise.
Returns Double
Errors 13, 91, 94, 450
Status Implemented
Module Financial
Since VB 3.0
Example
Try it





See also DDB, IPmt, IRR, MIRR, NPer, NPV, Pmt, PPmt, PV, Rate, SLN, SYD
Function GetAllSettings
Description Returns an array of key name and value pairs from a Registry entry for an application.
Parameters
Name appName
Type String
Required? Yes
Use Name of the application for which these settings applies.
Name section
Type String
Required? Yes
Use Name of the section from where to get all settings.
Returns Variant
Status Not implemented
Module Interaction
Since VB 4.0
Example
Try it


See also DeleteSetting, GetSetting, SaveSetting
Function GetAttr
Description Returns a file's or directory's attributes.
Parameters
Name pathName
Type String
Required? Yes
Use Path to the file.
Returns VbFileAttribute
Status Not implemented
Module FileSystem
Since VB 2.0
Example
Try it
See also FileAttr, SetAttr
Function GetObject
Description Returns an ActiveX object reference either from a file or a running program.
Parameters
Name pathName
Type Variant (String)
Required? No
Use Path to the file containing the object. If not provided, clasName must be present.
Name className
Type Variant (String)
Required? No
Use ProgID of the object.
Returns Variant (Object)
Status Not implemented
Module Interaction
Since VB 3.0
Example
Try it


See also CreateObject
Function GetSetting
Description Returns the value of a key setting from an application's Registry entry.
Parameters
Name appName
Type String
Required? Yes
Use Name of the application for which this setting applies.
Name section
Type String
Required? Yes
Use Name of the section from where to get the setting value.
Name key
Type String
Required? Yes
Use Name of the key to retrieve its value
Name defaultValue
Type Variant
Required? No
Use Value to be returned in case app, section, or key does not exist.
Returns String
Status Not implemented
Module Interaction
Since VB 4.0
Example
Try it




See also DeleteSetting, GetAllSettings, SaveSetting
Function Hex
Description Returns a string that represents a number's hexadecimal value.
Parameters
Name number
Type Variant
Required? Yes
Use Number to be converted to string in hexadecimal format.
Returns Variant (Null / String)
Errors 6, 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 1.0
Example
Try it
See also Bin, Oct
Function Hex$
Description Returns a string that represents a number's hexadecimal value.
Parameters
Name number
Type Variant
Required? Yes
Use Number to be converted to string in hexadecimal format.
Returns String
Errors 6, 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 1.0
Example
Try it
See also Bin, Oct
Function Hour
Description Returns an integer number that represents the hour of the given date.
Parameters
Name time
Type Variant
Required? Yes
Use Date from which the hour part will be extracted.
Returns Variant (Null / Integer)
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module DateTime
Since VB 1.0
Example
Try it
See also Str
Function IIf
Description Returns truePart if expression is true, otherwise returns falsePart.
Parameters
Name expression
Type Variant
Required? Yes
Use Expression to be evaluated.
Name truePart
Type Variant
Required? Yes
Use Value to return if expression is True.
Name falsePart
Type Variant
Required? Yes
Use Value to return if expression is False.
Returns Variant
Errors 6, 13, 91, 94, 450
Status Implemented
Module Interaction
Since VB 3.0
Example
Try it



See also Choose, Switch
Function IMEStatus
Description Returns the current Input Method Editor mode.
Parameters -
Returns VbIMEStatus
Status Not implemented
Module Information
Since VB 4.0
Example
Try it
See also
Statement Input
Description Returns a String with characters from a file that has been opened in Input or Binary mode.
Parameters
Name
Type
Required?
Use
Returns
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Try it
See also
Statement Input$
Description Returns a String with characters from a file that has been opened in Input or Binary mode.
Parameters
Name
Type
Required?
Use
Returns
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Try it
See also
Statement InputB
Description Returns byte data from a file that has been opened in Input or Binary mode
Parameters
Name
Type
Required?
Use
Returns
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Try it
See also
Statement InputB$
Description Returns byte data from a file that has been opened in Input or Binary mode
Parameters
Name
Type
Required?
Use
Returns
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Try it
See also
Function InputBox
Description Displays a message in a dialog box and returns the text entered by the user.
Parameters
Name promptText
Type Variant
Required? Yes
Use Text to be displayed to user.
Name title
Type Variant
Required? No
Default App name
Use Title of the input box. If ommited, the name of the program is displayed.
Name defaultValue
Type Variant
Required? No
Default Empty string
Use Value to be returned if user cancels the input box.
Name xPos
Type Variant (Single)
Required? No
Use X-axis screen position for the input box. Currently not implemented.
Name yPos
Type Variant (Single)
Required? No
Use Y-axis screen position for the input box.. Currently not implemented.
Name helpFile
Type Variant
Required? No
Use Path for the help file.. Currently not implemented.
Name context
Type Variant
Required? No
Use Help context for the message.. Currently not implemented.
Returns String
Errors 13, 91, 94, 450
Status Implemented
Module Interaction
Since VB 1.0
Example
Try it







See also MsgBox
Function InStr
Description Returns the 1-based index of the first occurrence of a string within another.
Parameters
Name start
Type Variant
Required? No
Use Start position for the search.
Name string1
Type Variant
Required? Yes
Use String searched in.
Name string2
Type Variant
Required? Yes
Use String searched for.
Name compare
Type VbCompareMethod
Required? No
Default vbBinaryCompare
Use Whether the comparison should be case sensitive or not.
Returns Variant (Null/ Long)
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module Strings
Since VB 1.0
Example
Try it


compare

See also InStrRev, StrComp
Function InStrB
Description Returns the 1-based index of the first byte occurrence of a string within another.
Parameters
Name start
Type Variant
Required? No
Use Start position for the search.
Name string1
Type Variant
Required? Yes
Use String searched in.
Name string2
Type Variant
Required? Yes
Use String searched for.
Name compare
Type VbCompareMethod
Required? No
Default vbBinaryCompare
Use Whether the comparison should be case sensitive or not.
Returns Variant (Null / Long)
Status Not implemented
Module Strings
Since VB 1.0
Example
Try it


compare

See also InStrRev, StrComp
Function InStrRev
Description Returns the 1-based index of the last occurrence of a string within another.
Parameters
Name stringCheck
Type String
Required? Yes
Use String searched in.
Name stringMatch
Type String
Required? Yes
Use String searched for.
Name start
Type Long
Required? No
Default -1
Use Start position for the search.
Name compare
Type VbCompareMethod
Required? No
Default vbBinaryCompare
Use Whether the comparison should be case sensitive or not.
Returns Long
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module Strings
Since VB 6.0
Example
Try it


compare

See also
Function Int
Description Discards the fractionary part of a number returning it as an integer.
Rounding is done in towards negative infinity fashion.
Parameters
Name number
Type Variant
Required? Yes
Use Number to be rounded.
Returns Variant (Null / same data type as number)
Errors 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 1.0
Example
Try it
See also Fix, Round
Function IPmt
Description Returns the annuity's interest payment for a given time.
Parameters
Name rate
Type Double
Required? Yes
Use Interest rate per period.
Name per
Type Double
Required? Yes
Use Payment period between 1 and nPer
Name nPer
Type Double
Required? Yes
Use Total number of payment periods in annuity.
Name pv
Type Double
Required? Yes
Use Present value.
Name fv
Type Variant (Double)
Required? No
Default 0
Use Future value.
Name due
Type Variant (Boolean)
Required? No
Default False
Use Specify when payments are due. True if at the beginning of the period, False otherwise.
Returns Double
Errors 5, 13, 91, 94, 450
Status Implemented
Module Financial
Since VB 3.0
Example
Try it






See also DDB, FV, IRR, MIRR, NPer, NPV, Pmt, PPmt, PV, Rate, SLN, SYD
Function IRR
Description For a sequence of periodic cash flows, it returns the internal rate of return.
Parameters
Name valueArray
Type Array of Doubles.
Required? Yes
Use Array containing class flow values. It must contain ate least one positive value (a receipt) and one negative value (a payment).
Name guess
Type Variant (Double)
Required? No
Default 0.1
Use Estimation of the result for the function.
Returns Double
Errors 5, 13, 450
Status Implemented
Module Financial
Since VB 3.0
Example
Try it


See also DDB, FV, IPmt, MIRR, NPer, NPV, Pmt, PPmt, PV, Rate, SLN, SYD
Function IsArray
Description Returns whether the variable is an array or not.
Parameters
Name varName
Type Variant
Required? Yes
Use Variable to check.
Returns Boolean
Errors 450
Status Implemented
Module Information
Since VB 4.0
Example
Try it
See also Array, IsDate, IsEmpty, IsError, IsMissing, IsNull, IsNumeric, IsObject, TypeName, VarType,
Function IsDate
Description Returns whether the variable can be converted to a date or not.
Parameters
Name varName
Type Variant
Required? Yes
Use Variable to check.
Returns Boolean
Errors 450
Status Implemented
Module Information
Since VB 2.0
Example
Try it
See also Date, IsArray, IsEmpty, IsError, IsMissing, IsNull, IsNumeric, IsObject, TypeName, VarType,
Function IsEmpty
Description Returns True if a variable contains the Empty value.
Parameters
Name varName
Type Variant
Required? Yes
Use Variable to check.
Returns Boolean
Errors 450
Status Implemented
Module Information
Since VB 2.0
Example
Try it
See also IsArray, IsDate, IsError, IsMissing, IsNull, IsNumeric, IsObject, TypeName, VarType,
Function IsError
Description Returns True if a variable contains an error value.
Parameters
Name varName
Type Variant
Required? Yes
Use Variable to check.
Returns Boolean
Errors 450
Status Implemented
Module Information
Since VB 4.0
Example
Try it
See also CVError, IsArray, IsDate, IsEmpty, IsMissing, IsNull, IsNumeric, IsObject, TypeName, VarType,
Function IsLeapYear
Description Returns True if the year in dateValue is a leap year.
Parameters
Name dateValue
Type Date
Required? Yes
Use Date to check.
Returns Boolean
Errors 450
Status Implemented
Module Information
Since VB 6.7
Example
Try it
See also Array, IsDate, IsEmpty, IsError, IsMissing, IsNull, IsNumeric, IsObject, TypeName, VarType,
Function IsMissing
Description Returns True if no valor has been provided for an optional argument.
Parameters
Name varName
Type Variant
Required? Yes
Use Parameter to check.
Returns Boolean
Errors 450
Status Implemented
Module Information
Since VB 4.0
Example
Try it
See also IsArray, IsDate, IsEmpty, IsError, IsNull, IsNumeric, IsObject, TypeName, VarType,
Function IsNothing
Description Returns True if a variable contains the Nothing value.
Parameters
Name varName
Type Variant
Required? Yes
Use Variable to check.
Returns Boolean
Errors 450
Status Implemented
Module Information
Since VB 6.7
Example
Try it
See also IsArray, IsDate, IsEmpty, IsError, IsMissing, IsNumeric, IsObject, TypeName, VarType,
Function IsNull
Description Returns True if a variable contains the Null value.
Parameters
Name varName
Type Variant
Required? Yes
Use Variable to check.
Returns Boolean
Errors 450
Status Implemented
Module Information
Since VB 2.0
Example
Try it
See also IsArray, IsDate, IsEmpty, IsError, IsMissing, IsNumeric, IsObject, TypeName, VarType,
Function IsNumeric
Description Returns True if an expression can be converted to a number.
Parameters
Name expression
Type Variant
Required? Yes
Use Variable to check.
Returns Boolean
Errors 450
Status Implemented
Module Information
Since VB 2.0
Example
Try it
See also IsArray, IsDate, IsEmpty, IsError, IsMissing, IsNull, IsObject, TypeName, VarType,
Function IsObject
Description Returns True if a variable contains an object reference.
Parameters
Name varName
Type Variant
Required? Yes
Use Variable to check.
Returns Boolean
Errors 450
Status Implemented
Module Information
Since VB 4.0
Example
Try it
See also IsArray, IsDate, IsEmpty, IsError, IsMissing, IsNull, IsNumeric, TypeName, VarType,
Function Join
Description Concatenates each element of a string array into a string.
Parameters
Name sourceArray
Type Variant
Required? Yes
Use Array containing the elements to be joined.
Name delimiter
Type Variant (String)
Required? No
Use Delimiter to be used when joining the elements. If not provided, as space will be used.
Returns String
Errors 13, 91, 450
Status Implemented
Module Strings
Since VB 6.0
Example
Try it


See also Split
Sub Kill
Description Removes files from a hard drive.
Parameters
Name pathName
Type Variant (String)
Required? Yes
Use File path.
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Try it
See also RmDir
Function LBound
Description Returns the index of the first element of the dimension in the array.
Parameters
Name arrayName
Type Variant
Required? Yes
Use Array. It must be a fixed-size array or a ReDimmed one.
Name dimension
Type Variant (Long
Required? No
Default 1
Use Dimension to be inspected.
Returns Long
Errors 13, 450
Status Implemented
Module Information
Since VB 1.0
Example
Try it
See also UBound
Fnction LCase
Description Converts the given string parameter to lowercase.
Parameters
Name stringValue
Type Variant
Required? Yes
Use Text to be converted.
Returns Variant (Null / String)
Errors 13, 91, 450
Status Implemented
Module Strings
Since VB 1.0
Example
Debug.Print LCase("Don't. You. Scream. At. Me!")
don't. you. scream. at. me!
Try it
See also LCase$, UCase, UCase$
Function LCase$
Description Converts the given string parameter to lowercase.
Parameters
Name stringValue
Type String
Required? Yes
Use Text to be converted.
Returns String
Errors 13, 91, 450
Status Implemented
Module Strings
Since VB 1.0
Example
Debug.Print LCase$("Don't. You. Scream. At. Me!")
don't. you. scream. at. me!
Try it
See also LCase, UCase, UCase$
Function Left
Description Returns a given amount of characters from a string's left side.
Parameters
Name stringValue
Type Variant
Required? Yes
Use String to be used.
Name length
Type Long
Required? Yes
Use How many characters to return.
Returns Variant (Null / String)
Errors 6, 13, 91, 94, 450
Status Implemented
Module Strings
Since VB 1.0
Example
Try it


See also Len, Mid, Right
Function Left$
Description Returns a given amount of characters from a string's left side.
Parameters
Name stringValue
Type Variant
Required? Yes
Use String to be used.
Name length
Type Long
Required? Yes
Use How many characters to return.
Returns Variant (Null / String)
Errors 6, 13, 91, 94, 450
Status Implemented
Module Strings
Since VB 1.0
Example
Try it


See also Len, Mid, Right
Function LeftB
Description Returns a given amount of bytes from a string's left side.
Parameters
Name stringValue
Type Variant
Required? Yes
Use String to be used.
Name length
Type Long
Required? Yes
Use How many characters to return.
Returns Variant (Null / String)
Status Not implemented
Module Strings
Since VB 1.0
Example
Try it


See also Len, Mid, Right
Function LeftB$
Description Returns a given amount of bytes from a string's left side.
Parameters
Name stringValue
Type Variant
Required? Yes
Use String to be used.
Name length
Type Long
Required? Yes
Use How many characters to return.
Returns String
Errors 6, 13, 91, 94, 450
Status Not implemented
Module Strings
Since VB 1.0
Example
Try it


See also Len, Mid, Right
Function Len
Description Returns the number of characters in a String or Decimal string representation.
For numbers, dates, and user-defined types (UDTs), returns the number of bytes required to store them.
Note: For UDTs, the size is calculated not taking padding into consideration.
Parameters
Name expression
Type Variant
Required? Yes
Use Variable to be measured.
Returns Variant (Null / Long)
Errors 13, 450
Status Partially implemented
Module Information
Since VB 1.0
Example
Try it
See also InStr
Function LenB
Description Returns the number of bytes in a String or Decimal string representation.
For numbers, dates, and user-defined types (UDTs), returns the number of bytes required to store them.
Note: For UDTs, the size is calculated taking padding into consideration.
Parameters
Name expression
Type Variant
Required? Yes
Use Variable to be measured.
Returns Variant (Null / Long)
Status Not implemented
Module Information
Since VB 1.0
Example
Try it
See also InStr
Operator Like
Description Compares one string against a pattern and returns True if it matches the pattern.
Parameters
Name lhs
Type Variant
Required? Yes
Use String to be compared.
Name rhs
Type Variant
Required? Yes
Use Pattern to be used.
Returns Variant (Null / Boolean)
Errors 93, 450
Status Implemented
Module Operators
Since VB 2.0
Example
Try it


See also
Statement Line Input
Description Reads a line of text from a file.
Parameters
Name fileNumber
Type Integer
Required? Yes
Use File handler from which to retrieve the text line.
Name varName
Type Variant or String.
Required? Yes
Use Variable that will receive the text line.
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Try it
See also Chr, Input
Functio Loc
Description If the file represented by fileNumber is open, returns the current read or write position within it, otherwise an error is raised.
Parameters
Name fileNumber
Type Integer
Required? Yes
Use File handler to be queried about the current position.
Returns Long
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Try it
See also EOF, LOF, Seek
Function LOF
Description If the file represented by fileNumber is open, returns the size in bytes of it, otherwise an error is raised.
Parameters
Name fileNumber
Type Long
Required? Yes
Use File handler to be queried about the size.
Returns Long
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Try it
See also EOF, FileLen, Loc, Open
Function Log
Description Returns the given number's natural logarithm.
Parameters
Name number
Type Double
Required? Yes
Use Number. Must be greater than zero.
Returns Double
Errors 5, 450
Status Implemented
Module Math
Since VB 1.0
Example
Try it
See also Exp
Function LTrim
Description Returns a copy of the given string with its leading spaces removed.
Parameters
Name stringValue
Type Variant
Required? Yes
Use String to be trimmed.
Returns Variant (Null / String)
Errors 13, 91, 450
Status Implemented
Module Strings
Since VB 1.0
Example
Try it
See also
Function LTrim$
Description Returns a copy of the given string with its leading spaces removed.
Parameters
Name stringValue
Type Variant
Required? Yes
Use String to be trimmed.
Returns String
Errors 13, 91, 450
Status Implemented
Module Strings
Since VB 1.0
Example
Try it
See also
Function MacID
Description Creates a Macintosh file type or signature from a four-character constant.
Parameters
Name constant
Type String
Required? Yes
Use String to be converted to Long.
Returns Long
Errors 13, 91, 450
Status Implemented
Module Conversion
Since VB 5.0
Example
Try it
See also
Function Mid
Description Returns a given amount of characters from a string.
Parameters
Name stringValue
Type Variant
Required? Yes
Use String to be used.
Name start
Type Long
Required? Yes
Use Start position.
Name length
Type Variant (Long)
Required? No
Use How many characters to return.
Returns Variant (Null / String)
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module Strings
Since VB 1.0
Example
Try it



See also
Function Mid$
Description Returns a given amount of characters from a string.
Parameters
Name stringValue
Type Variant
Required? Yes
Use String to be used.
Name start
Type Long
Required? Yes
Use Start position.
Name length
Type Variant (Long)
Required? No
Use How many characters to return.
Returns String
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module Strings
Since VB 1.0
Example
Try it



See also
Function MidB
Description Returns a given amount of bytes from a string.
Parameters
Name stringValue
Type Variant
Required? Yes
Use String to be used.
Name start
Type Long
Required? Yes
Use Start position.
Name length
Type Variant (Long)
Required? No
Use How many bytes to return.
Returns Variant (Null / String)
Status Not implemented
Module Strings
Since VB 1.0
Example
Try it



See also
Function MidB$
Description Returns a given amount of bytes from a string.
Parameters
Name stringValue
Type Variant
Required? Yes
Use String to be used.
Name start
Type Long
Required? Yes
Use Start position.
Name length
Type Variant(Long)
Required? No
Use How many bytes to return.
Returns String
Status Not implemented
Module Strings
Since VB 1.0
Example
Try it



See also
Statement Mid
Description
Parameters
Name stringValue
Type Variant
Required? Yes
Use
Name start
Type Long
Required? Yes
Use
Name length
Type Variant (Long)
Required? No
Use
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module Strings
Since VB 1.0
Example
Try it




See also
Function Minute
Description Returns an integer number that represents the minutes of the given date.
Parameters
Name time
Type Variant
Required? Yes
Use Date from which the minute part will be extracted.
Returns Variant (Null / Integer)
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module DateTime
Since VB 1.0
Example
Try it
See also
Function MIRR
Description For a set of periodic cash flows, returns the updated internal rate of return.
Parameters
Name valueArray
Type Double()
Required? Yes
Use Array containing class flow values.
It must contain ate least one positive value (a receipt) and one negative value (a payment).
Name financeRate
Type Double
Required? Yes
Use Interest rate paid.
Name reinvestRate
Type Double
Required? Yes
Use Interest rate received by reinvesting cash.
Returns Double
Errors 5, 11, 13, 91, 94, 450
Status Implemented
Module Financial
Since VB 3.0
Example
Try it



See also DDB, FV, IPmt, IRR, NPer, NPV, Pmt, PPmt, PV, Rate, SLN, SYD
Sub MkDir
Description This command makes a new directory.
Parameters
Name path
Type String
Required? Yes
Use Directory path.
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Try it
See also
Function Month
Description Returns an integer number that represents the month of the given date.
Parameters
Name dateValue
Type Variant
Required? Yes
Use Date from which the month part will be extracted.
Returns Variant (Null / Integer)
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module DateTime
Since VB 1.0
Example
Try it
See also
Function MonthName
Description Returns the name of the month in the system's language.
Parameters
Name month
Type Long
Required? Yes
Use Number of the month. 1 is January.
Name abbreviate
Type Boolean
Required? No
Use Whether to return the name abbreviate or in full.
Returns String
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module Strings
Since VB 6.0
Example
Try it


See also
Function MsgBox
Description Displays a message in a dialog box and returns which button was clicked by the user.
Parameters
Name promptText
Type Variant
Required? Yes
Use Text to be displayed to user.
Name buttons
Type Variant (Long)
Required? No
Default vbOKOnly
Use Which buttons should be displayed to user.
Use VbMsgBoxStyle.
Name title
Type Variant (String)
Required? No
Default App's name
Use Title of the message box. If ommited, the name of the program is displayed.
Name helpFile
Type Variant
Required? No
Use Path for the help file.
Name context
Type Variant
Required? No
Use Help context for the message.
Returns VbMsgBoxResult
Errors 13, 91, 450
Status Implemented
Module Interaction
Since VB 1.0
Example
Try it
buttons








Result:
See also
Statement Name
Description
Parameters
Name oldPathname
Type String
Required? Yes
Use
Name newPathname
Type String
Required? Yes
Use
Returns
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Try it
See also
Property Now
Description Returns the current date/time.
Parameters -
Returns Variant (Date)
Errors 6, 13, 91, 94, 450
Status Implemented
Module DateTime
Since VB 1.0
Example
Try it
See also
Function NPer
Description Returns the number of periods in an annuity.
Parameters
Name rate
Type Double
Required? Yes
Use Interest rate per period.
Name pmt
Type Double
Required? Yes
Use Payment per period.
Name pv
Type Double
Required? Yes
Use Present value.
Name fv
Type Variant (Double)
Required? No
Use Future value.
Name due
Type Variant (Boolean)
Required? No
Use Specify when payments are due. True if at the beginning of the period, False otherwise.
Returns Double
Errors 5, 13, 91, 94, 450
Status Implemented
Module Financial
Since VB 3.0
Example
Try it





See also DDB, FV, IPmt, IRR, MIRR, NPV, Pmt, PPmt, PV, Rate, SLN, SYD
Function NPV
Description Calculates the net present value of an investment using a sequence of periodic payments or receipts and a discount rate.
Parameters
Name rate
Type Double
Required? Yes
Use Interest rate per period.
Name valueArray
Type Double()
Required? Yes
Use Array containing class flow values. It must contain ate least one positive value (a receipt) and one negative value (a payment).
Returns Double
Errors 13, 91, 94, 450
Status Implemented
Module Financial
Since VB 3.0
Example
Try it


See also DDB, FV, IPmt, IRR, MIRR, NPer, Pmt, PPmt, PV, Rate, SLN, SYD
Function ObjPtr
Description Returns the memory's address of an object.
Parameters
Name ptr
Type IUnknown
Required? Yes
Use Variable containing the object reference.
Returns LongPtr
Status Not implemented
Module Hidden
Since VB 5.0
Example
Try it
See also
Function Oct
Description Returns a string that represents a number's octal value.
Parameters
Name number
Type Variant
Required? Yes
Use Number to be converted to string in octal format.
Returns Variant (Null / String)
Errors 6, 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 1.0
Example
Try it
See also Bin Hex
Function Oct$
Description Returns a string that represents a number's octal value.
Parameters
Name number
Type Variant
Required? Yes
Use Number to be converted to string in octal format.
Returns String
Errors 6, 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 1.0
Example
Try it
See also Bin Hex
Statement Open
Description
Parameters
Name pathName
Type String
Required? Yes
Use
Name mode
Type Keyword
Required? Yes
Use
Name access
Type Keyword
Required? No
Default Read Write
Use
Name lock
Type Keyword
Required? No
Use
Name fileNumber
Type Integer
Required? Yes
Use Number to be used as file handler.
Name recLength
Type Long
Required? No
Use
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Try it
See also Close
Function Partition
Description Returns a formated string indicating the position of a number inside a set of ranges.
Parameters
Name number
Type Variant
Required? Yes
Use Number to be evaluated against the ranges.
Name startValue
Type Variant
Required? Yes
Use Start of the range of numbers.
Name stopValue
Type Variant
Required? Yes
Use End of the range of numbers.
Name interval
Type Variant
Required? Yes
Use Interval to which startValue and stopValue must be divided.
Returns Variant (Null / String)
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module Interaction
Since VB 3.0
Example
Try it




See also
Function Pmt
Description Calculates the payment for an annuity using periodic and fixed payments and an interest rate.
Parameters
Name rate
Type Double
Required? Yes
Use Interest rate per period.
Name nPer
Type Double
Required? Yes
Use Total number of payment periods in the annuity.
Name pv
Type Double
Required? Yes
Use Present value.
Name fv
Type Variant (Double)
Required? No
Use Future value.
Name due
Type Variant (Boolean)
Required? No
Use Specify when payments are due. True if at the beginning of the period, False otherwise.
Returns Double
Errors 5, 13, 91, 94, 450
Status Implemented
Module Financial
Since VB 3.0
Example
Try it





See also DDB, FV, IPmt, IRR, MIRR, NPer, NPV, PPmt, PV, Rate, SLN, SYD
Function PPmt
Description Returns the principal payment for a given period of an annuity.
Parameters
Name rate
Type Double
Required? Yes
Use Interest rate per period.
Name per
Type Double
Required? Yes
Use Payment period between 1 and nPer
Name nPer
Type Double
Required? Yes
Use Total number of payment periods in the annuity.
Name pv
Type Double
Required? Yes
Use Present value.
Name fv
Type Variant (Double)
Required? No
Use Future value.
Name due
Type Variant (Boolean)
Required? No
Use Specify when payments are due. True if at the beginning of the period, False otherwise.
Returns Double
Errors 5, 13, 91, 94, 450
Status Implemented
Module Financial
Since VB 3.0
Example
Try it






See also DDB, FV, IPmt, IRR, MIRR, NPer, NPV, Pmt, PV, Rate, SLN, SYD
Statement Print
Description Outputs text to a file.
Parameters
Name fileNumber
Type Integer
Required? Yes
Use File handler of the file being written.
Name outputList
Type ParamArray
Required? No
Use List of values to be written.
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Try it
See also
Statement Put
Description Outputs data to a file.
Parameters
Name fileNumber
Type Integer
Required? Yes
Use File handler of the file being written.
Name recNumber
Type Integer
Required? No
Use In Random mode, number of the record to start writing.
In Binary mode, number of the byte to start writing.
Name varName
Type Variant
Required? Yes
Use Value being written.
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Try it
See also
Function PV
Description Calculates the present value of an annuity.
Parameters
Name rate
Type Double
Required? Yes
Use Interest rate per period.
Name nPer
Type Double
Required? Yes
Use Total number of payment periods in the annuity.
Name pmt
Type Double
Required? Yes
Use Payment per period.
Name fv
Type Variant (Double)
Required? No
Use Future value.
Name due
Type Variant (Boolean)
Required? No
Use Specify when payments are due. True if at the beginning of the period, False otherwise.
Returns Double
Errors 11, 13, 91, 94, 450
Status Implemented
Module Financial
Since VB 3.0
Example
Try it





See also DDB, FV, IPmt, IRR, MIRR, NPer, NPV, Pmt, PPmt, Rate, SLN, SYD
Function QBColor
Description From a list of established standard colors, returns the RGB color code for a given color number.
Parameters
Name color
Type Integer
Required? Yes
Use One of the following numbers:
0 Black
1 Blue
2 Green
3 Cyan
4 Red
5 Magenta
6 Yellow
7 White
8 Gray
9 Light blue
10 Light green
11 Light cyan
12 Light red
13 Light magenta
14 Light yellow
15 Bright white
Returns Long
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module Information
Since VB 1.0
Example
Try it
See also
Sub Randomize
Description Defines the seed for the random-number generator.
Parameters
Name number
Type Variant (Single)
Required? No
Use If provided, Rnd's seed will be calculated using it, otherwise, Timer will be used.
Returns
Errors 13, 91, 94, 450
Status Implemented
Module Math
Since VB 1.0
Example
Try it
See also
Function Rate
Description Calculates the interest rate per period for an annuity.
Parameters
Name nPer
Type Double
Required? Yes
Use Total number of payment periods in the annuity.
Name pmt
Type Double
Required? Yes
Use Payment per perido.
Name pv
Type Double
Required? Yes
Use Present value.
Name fv
Type Variant (Double)
Required? No
Use Future value.
Name due
Type Variant (Boolean)
Required? No
Use Specify when payments are due. True if at the beginning of the period, False otherwise.
Name guess
Type Variant (Double)
Required? No
Default 0.1
Use Estimation of the result for the function.
Returns Double
Errors 5, 13, 91, 94, 450
Status Implemented
Module Financial
Since VB 3.0
Example
Try it






See also DDB, FV, IPmt, IRR, MIRR, NPer, NPV, Pmt, PPmt, PV, SLN, SYD
Function Replace
Description Replaces all occurrences of a substring within a string with the provided substitute string.
Parameters
Name expression
Type String
Required? Yes
Use String searched in.
Name find
Type String
Required? Yes
Use String searched for.
Name replaceWith
Type String
Required? Yes
Use String used as replacement.
Name start
Type Long
Required? No
Use Start position.
Name count
Type Long
Required? No
Use Maximum number of replacements to be performed.
Name compare
Type VbCompareMethod
Required? No
Default vbBinaryCompare
Use Whether the comparison should be case sensitive or not.
Returns String
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module Strings
Since VB 3.0
Example
Try it




compare

See also
Sub Reset
Description Write any pending data in buffers to hard drive and closes all open files.
Parameters -
Errors 450
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Try it
See also
Function RGB
Description Merges red, green, and blue into an integer representing a color and returns it.
Parameters
Name red
Type Integer
Required? Yes
Use Red component of the color.
Name green
Type Integer
Required? Yes
Use Green component of the color.
Name blue
Type Integer
Required? Yes
Use Blue component of the color.
Returns Long
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module Information
Since VB 1.0
Example
Try it



See also
Function Right$
Description Returns a given amount of characters from a string's right side.
Parameters
Name stringValue
Type Variant
Required? Yes
Use String to be used.
Name length
Type Long
Required? Yes
Use How many characters to return.
Returns String
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module Strings
Since VB 1.0
Example
Try it


See also
Function RightB
Description Returns a given amount of bytes from a string's right side.
Parameters
Name stringValue
Type Variant
Required? Yes
Use String to be used.
Name length
Type Long
Required? Yes
Use How many characters to return.
Returns Variant (Null / String)
Status Not implemented
Module Strings
Since VB 1.0
Example
Try it


See also
Function RightB$
Description Returns a given amount of bytes from a string's right side.
Parameters
Name stringValue
Type Variant
Required? Yes
Use String to be used.
Name length
Type Long
Required? Yes
Use How many characters to return.
Returns String
Status Not implemented
Module Strings
Since VB 1.0
Example
Try it


See also
Sub RmDir
Description Removes a directory from a hard drive.
Parameters
Name path
Type String
Required? Yes
Use Directory path.
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Try it
See also
Function Rnd
Description Returns a pseudo-random number in the range 0 (inclusive) to 1 (exclusive.)
Parameters
Name number
Type Variant (Integer)
Required? No
Use If number is negative, the same number is returned every time.
If number is zero, the last generated number is returned.
If number is positive or not provided, the next number in the sequence is returned.
Returns Single
Errors 13, 91, 94, 450
Status Implemented
Module Math
Since VB 1.0
Example
Try it
See also
Function Round
Description Rounds number to numDigitsAfterDecimal decimal places.
Parameters
Name number
Type Variant
Required? Yes
Use Number to be rounded.
Name numDigitsAfterDecimal
Type Long
Required? No
Use Number of decimal places.
Returns Variant (Null / same data type as number)
Errors 13, 450
Status Implemented
Module Math
Since VB 4.0
Example
Try it


See also
Function RTrim
Description Returns a copy of the given string with its trailing spaces removed.
Parameters
Name stringValue
Type Variant
Required? Yes
Use String to be trimmed.
Returns Variant (Null / String)
Errors 13, 91, 450
Status Implemented
Module Strings
Since VB 1.0
Example
Try it
See also
Function RTrim$
Description Returns a copy of the given string with its trailing spaces removed.
Parameters
Name stringValue
Type Variant
Required? Yes
Use String to be trimmed.
Returns String
Errors 13, 91, 450
Status Implemented
Module Strings
Since VB 1.0
Example
Try it
See also
Sub SaveSetting
Description Saves a setting value as string under the given appName, section and key names.
Parameters
Name appName
Type String
Required? Yes
Use Name of the application for which this setting applies.
Name section
Type String
Required? Yes
Use Name of the section of the setting to be saved.
Name key
Type String
Required? Yes
Use Name of the key to be saved.
Name setting
Type String
Required? Yes
Use Value being saved.
Status Not implemented
Module Interaction
Since VB 4.0
Example
Try it




See also
Function Second
Description Returns an integer number that represents the seconds of the given date.
Parameters
Name time
Type Variant
Required? Yes
Use Date from which the second part will be extracted.
Returns Variant (Null / Integer)
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module DateTime
Since VB 1.0
Example
Try it
See also
Function/Statement Seek
Description As a statement, sets the current position within a file for a read or write operation.
As a function, returns the current position.
Parameters
Name fileNumber
Type Integer
Required? Yes
Use File handler of the file being seeked.
Returns Long
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Try it
See also
Sub SendKeys
Description Simulates keystroke(s) to the active window.
Parameters
Name stringValue
Type String
Required? Yes
Use The characters and commands to be simulated.
Name wait
Type Variant (Boolean)
Required? No
Use Whether to wait until the current program has the focus before simulating keystrokes.
Status Not implemented
Module Interaction
Since VB 1.0
Example
Try it


See also
Sub SetAttr
Description Changes the attributes of a file.
Parameters
Name pathName
Type String
Required? Yes
Use File path.
Name attributes
Type VbFileAttribute
Required? Yes
Use Atrributes to applied to file.
Status Not implemented
Module FileSystem
Since VB 2.0
Example
Try it
attributes

See also FileAttr, GetAttr
Function Sgn
Description Returns 1 if number if positive, -1 if it is negative, and 0 if it is zero.
Parameters
Name number
Type Variant
Required? Yes
Use Number evaluated according to its sign.
Returns Variant (Integer)
Errors 5, 450
Status Implemented
Module Math
Since VB 1.0
Example
Try it
See also
Function Shell
Description Starts another program.
Parameters
Name pathName
Type Variant (String)
Required? Yes
Use Path to the executable file.
Name windowStyle
Type VbAppWinStyle
Required? No
Use State for the program's window.
Returns Double
Status Not implemented
Module Interaction
Since VB 1.0
Example
Try it
windowStyle

See also
Function Sin
Description Returns the sine of a number in radians.
To convert radians to degrees, multiply it by 180 then divide the result by 3.14159265358979.
Parameters
Name number
Type Double
Required? Yes
Use Length of the side opposite the angle divided by the length of the hypotenuse.
Returns Double
Errors 5, 450
Status Implemented
Module Math
Since VB 1.0
Example
Try it
See also
Function SLN
Description Calculates an asset's single-period straight-line depreciation.
Parameters
Name cost
Type Double
Required? Yes
Use The initial cost of the asset.
Name salvage
Type Double
Required? Yes
Use How much the asset will worth at the end of its life.
Name life
Type Double
Required? Yes
Use Length of the life of the asset.
Returns Double
Errors 5, 13, 91, 94, 450
Status Implemented
Module Financial
Since VB 3.0
Example
Try it



See also DDB, FV, IPmt, IRR, MIRR, NPer, NPV, Pmt, PPmt, PV, Rate, SYD
Function Space
Description Returns a string filled with spaces.
Parameters
Name number
Type Long
Required? Yes
Use Length of the string to return.
Returns Variant (String)
Errors 6, 13, 91, 94, 450
Status Implemented
Module Strings
Since VB 1.0
Example
Try it
See also
Function Space$
Description Returns a string filled with spaces.
Parameters
Name number
Type Long
Required? Yes
Use Length of the string to return.
Returns String
Errors 6, 13, 91, 94, 450
Status Implemented
Module Strings
Since VB 1.0
Example
Try it
See also
Function Spc
Description Used to position the output in a Print statement.
Parameters
Name n
Type Variant(Byte)
Required? Yes
Use Number of spaces to be inserted.
Returns Spc is a function that can only be used in a Print statement.
As such, it does not formally return anything.
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Try it
See also
Function Split
Description Splits a string into substrings based on the given separator and returns them as an array.
Parameters
Name expression
Type String
Required? Yes
Use String to be split.
Name delimiter
Type Variant
Required? No
Use String to be used as delimiter while spliting the string.
Name limit
Type Long
Required? No
Default -1
Use Maximum number of elements in the returned array.
Name compare
Type VbCompareMethod
Required? No
Default vbBinaryCompare
Use Whether the comparison should be case sensitive or not.
Returns Variant (String())
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module Strings
Since VB 6.0
Example
Try it


compare

See also
Function Sqr
Description Returns the square root of a number.
Parameters
Name number
Type Double
Required? Yes
Use Number to be squared.
Returns Double
Errors 5, 450
Status Implemented
Module Math
Since VB 1.0
Example
Try it
See also
Function Str
Description Converts a number to its string representation.
Unlike CStr, Str uses "." as the only decimal separator.
If the number is not negative, it also adds a space to the beginning of the string.
Parameters
Name number
Type Variant
Required? Yes
Use Number to be converted.
Returns Variant (Null / String)
Errors 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 1.0
Example
Try it
See also
Function Str$
Description Converts a number to its string representation.
Unlike CStr, Str uses "." as the only decimal separator.
If the number is not negative, it also adds a space to the beginning of the string.
Parameters
Name number
Type Variant
Required? Yes
Use Number to be converted.
Returns String
Errors 13, 91, 94, 450
Status Implemented
Module Conversion
Since VB 1.0
Example
Try it
See also
Function StrComp
Description Compares two strings and returns:
0 if they are equal,
1 if the left string is greater than the right one,
or -1 otherwise.
Parameters
Name string1
Type Variant
Required? Yes
Use First string to be compared.
Name string2
Type Variant
Required? Yes
Use Second string to be compared.
Name compare
Type VbCompareMethod
Required? No
Use Whether the comparison should be case sensitive or not.
Returns Variant
Errors 5, 13, 91, 450
Status Implemented
Module Strings
Since VB 2.0
Example
Try it

compare

See also
Function StrConv
Description Returns a copy of the string after operating the requested conversion on it.
Parameters
Name stringValue
Type Variant
Required? Yes
Use String to be converted.
Name conversion
Type VbStrConv
Required? Yes
Use Operation(s) to perform on the string.
Name localeID
Type Long
Required? No
Use Locale to be used on the conversion.
Returns Variant (Null / String)
Errors 5, 6, 13, 91, 94, 450
Status Partially implemented
Module Strings
Since VB 4.0
Example
Try it
Conversion




See also LCase, UCase
Function String
Description Returns a string filled with the given character.
Parameters
Name number
Type Long
Required? Yes
Use Length of the string to return.
Name character
Type Variant
Required? Yes
Use Character to be used when filling the string.
Returns Variant (Null / String)
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module Strings
Since VB 2.0
Example
Try it


See also
Function String$
Description Returns a string filled with the given character.
Parameters
Name number
Type Long
Required? Yes
Use Length of the string to return.
Name character
Type Variant
Required? Yes
Use Character to be used when filling the string.
Returns String
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module Strings
Since VB 2.0
Example
Try it


See also
Function StrPtr
Description Returns the memory's address of a string.
Parameters
Name ptr
Type String
Required? Yes
Use Variable containing the string reference.
Returns LongPtr
Status Not implemented
Module Hidden
Since VB 5.0
Example
Try it
See also
Function StrReverse
Description Inverts the order of the string's characters.
Parameters
Name expression
Type String
Required? Yes
Use String to be reversed.
Returns String
Errors 13, 91, 450
Status Implemented
Module Strings
Since VB 6.0
Example
Try it
See also
Function Switch
Description Evaluates even elements in an array one by one and,
upon finding the first that is True, returns the next (odd) element.
If no element evaluates to True, returns Null.
Parameters
Name varExpr
Type ParamArray
Required? Yes
Use Array having an even number of elements.
Returns Variant
Errors 5
Status Implemented
Module Interaction
Since VB 3.0
Example
Try it
See also
Function SYD
Description Calculates the asset's sum-of-years' digits depreciation.
Parameters
Name cost
Type Double
Required? Yes
Use The initial cost of the asset.
Name salvage
Type Double
Required? Yes
Use How much the asset will worth at the end of its life.
Name life
Type Double
Required? Yes
Use Length of the life of the asset.
Name period
Type Double
Required? Yes
Use Period of the depreciation for the calculation.
Both life and period must be expressed in the same unit, like months.
Returns Double
Errors 5, 13, 91, 94, 450
Status Implemented
Module Financial
Since VB 3.0
Example
Try it




See also DDB, FV, IPmt, IRR, MIRR, NPer, NPV, Pmt, PPmt, PV, Rate, SLN
Function Tab
Description Used to position the output in a Print statement.
Parameters
Name n
Type Byte
Required? No
Use Number of spaces to be inserted.
If not provided, the insertion point is moved to the next print zone.
Returns Tab is a function that can only be used in a Print statement.
As such, it does not formally return anything.
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Try it
See also
Function Tan
Description Returns the tangent of a number in radians.
To convert radians to degrees, multiply it by 180 then divide the result by 3.14159265358979.
Parameters
Name number
Type Double
Required? Yes
Use The length of the side opposite the angle divided by the length of the side adjacent to the angle.
Returns Double
Errors 5, 450
Status Implemented
Module Math
Since VB 1.0
Example
Try it
See also
Property Time
Description Returns or sets system's time.
Parameters -
Returns Variant (Date)
Errors 6, 13, 91, 94, 450
Status Implemented
Module DateTime
Since VB 1.0
Example
Debug.Print Time
01:23:45
Try it
See also Date, Format, Now, Time$
Property Time$
Description Returns or sets system's date.
Parameters -
Returns Date
Errors 6, 13, 91, 94, 450
Status Implemented
Module DateTime
Since VB 1.0
Example
Debug.Print Time$
01:23:45
Try it
See also Date, Format, Now, Time
Read-only Property Timer
Description Returns the amount of seconds that have passed since midnight.
Parameters -
Returns Single
Errors -
Status Implemented
Module DateTime
Since VB 1.0
Example
Try it
See also Randomize, Time
Function TimeSerial
Description Builds a time from the given hours, minutes, and seconds.
Parameters
Name hour
Type Integer
Required? Yes
Use The hour part.
Name minute
Type Integer
Required? Yes
Use The minute part.
Name second
Type Integer
Required? Yes
Use The second part.
Returns Variant (Date)
Errors 6, 13, 91, 94, 450
Status Implemented
Module DateTime
Since VB 1.0
Example
Try it



See also DateSerial, DateValue, Hour, Minute, Now, Second, TimeValue
Function TimeValue
Description Converts a string to a time.
Parameters
Name time
Type String
Required? Yes
Use The string to be converted.
Returns Variant (Date)
Errors 13, 91, 450
Status Implemented
Module DateTime
Since VB 1.0
Example
Try it
See also DateSerial, DateValue, Hour, Minute, Now, Second, TimeSerial
Function Trim
Description Returns a copy of the given string with its leading and trailing spaces removed.
Parameters
Name stringValue
Type Variant
Required? Yes
Use String to be trimmed.
Returns Variant (Null / String)
Errors 13, 91, 450
Status Implemented
Module Strings
Since VB 2.0
Example
Try it
See also Left, LTrim, Right, RTrim
Function Trim$
Description Returns a copy of the given string with its leading and trailing spaces removed.
Parameters
Name stringValue
Type Variant
Required? Yes
Use String to be trimmed.
Returns String
Errors 13, 91, 450
Status Implemented
Module Strings
Since VB 2.0
Example
Try it
See also Left, LTrim, Right, RTrim
Function TypeName
Description Returns the name of the sbtype of a variable.
Parameters
Name varName
Type Variant
Required? Yes
Use Variable whose subtype name will be returned.
Returns String
Errors 450
Status Implemented
Module Information
Since VB 4.0
Example
Try it
See also IsArray, IsDate, IsEmpty, IsError, IsMissing, IsNull, IsNumeric, IsObject, VarType
Function UBound
Description Returns the index of the last element of the dimension in the array.
Parameters
Name arrayName
Type Variant
Required? Yes
Use Array. It must be a fixed-size array or a ReDimmed one.
Name dimension
Type Variant (Long)
Required? No
Default 1
Use Dimension to be inspected.
Returns Long
Errors 13, 450
Status Implemented
Module Information
Since VB 1.0
Example
Try it
See also LBound
Function UCase
Description Converts the given string parameter to uppercase.
Parameters
Name stringValue
Type Variant
Required? Yes
Use Text to be converted.
Returns Variant (Null / String)
Errors 13, 91, 450
Status Implemented
Module Strings
Since VB 1.0
Example
Debug.Print UCase("Don't scream at me!")
DON'T SCREAM AT ME!
Try it
See also LCase, LCase$, UCase$
Function UCase$
Description Converts the given string parameter to uppercase.
Parameters
Name stringValue
Type String
Required? Yes
Use Text to be converted.
Returns String
Errors 13, 91, 450
Status Implemented
Module Strings
Since VB 1.0
Example
Debug.Print UCase$("Don't scream at me!")
DON'T SCREAM AT ME!
Try it
See also LCase, LCase$, UCase
Function Unescape
Description Converts any heaxadecimal number preceded by '%' in a string
to its correspondent non-ASCII character.
Parameters
Name charString
Type String
Required? Yes
Use String to be converted.
Returns String
Errors 450
Status Implemented
Module Strings
Since VB 6.7
Example
Debug.Print Unescape("a%20&lt;&gt;%20b")
a <> b
Try it
See also Escape
Function Val
Description Converts a string into its number representation.
Any leading or trailing spaces are trimmed.
Accepts numbers in binary, octal, decimal, hexadecimal, and scientific notation.
Comas are ignored, only valid decimal separator is ".".
Parameters
Name stringValue
Type String
Required? Yes
Use
Returns Double
Errors 13, 91, 450
Status Implemented
Module Conversion
Since VB 1.0
Example
Try it
See also Str
Function VarPtr
Description Returns the memory's address of a variable.
Parameters
Name ptr
Type Any
Required? Yes
Use Variable.
Returns LongPtr
Status Not implemented
Module Hidden
Since VB 5.0
Example
Try it
See also ObjPtr, StrPtr
Function VarType
Description Returns a number defining the sbtype of a variable.
Parameters
Name varName
Type Variant
Required? Yes
Use Variable whose subtype number will be returned.
Returns VbVarType
Errors 450
Status Implemented
Module Information
Since VB 2.0
Example
Try it
See also IsArray, IsDate, IsEmpty, IsError, IsMissing, IsNull, IsNumeric, IsObject,
Function Weekday
Description Returns an integer number that represents the weekday of the given date.
Parameters
Name dateValue
Type Variant
Required? Yes
Use Date from which the weekday part will be extracted.
Name firstDayOfWeek
Type VbDayOfWeek
Required? No
Use Sets what is the first day of the week.
Returns VbDayOfWeek
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module DateTime
Since VB 1.0
Example
Try it

See also Date, Day, Month, Now, WeekdayName, Year
Function WeekdayName
Description Returns the name of the weekday in the system's language.
Parameters
Name weekday
Type Long
Required? Yes
Use Number of the weekday. Use VbDayOfWeek.
Name abbreviate
Type Boolean
Required? No
Use Whether to return the name abbreviated or in full.
Name firstDayOfWeek
Type VbDayOfWeek
Required? No
Use Sets what is the first day of the week.
Returns String
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module Strings
Since VB 6.0
Example
Try it



See also MonthName
Sub Width
Description Sets the maximum output line width for an open file.
Parameters
Name fileNumber
Type Integer
Required? Yes
Use File handler for which the width if being set.
Name widthNumber
Type Integer
Required? Yes
Use How many characters can be outputed before starting a new line.
Status Not implemented
Module Hidden
Since VB 1.0
Example
Try it


See also Open, Print
Statement Write
Description Writes data to a file.
Parameters
Name fileNumber
Type Integer
Required? Yes
Use File handler of the file being written.
Name outputList
Type ParamArray
Required? No
Use List of values to be written.
Status Not implemented
Module FileSystem
Since VB 1.0
Example
Try it
See also Input, Open, Print
Function Year
Description Returns an integer number that represents the year of the given date.
Parameters
Name dateValue
Type Variant
Required? Yes
Use Date from which the year part will be extracted.
Returns Variant (Null / Integer)
Errors 5, 6, 13, 91, 94, 450
Status Implemented
Module DateTime
Since VB 1.0
Example
Try it
See also Date, Day, Month, Now, Weekday
Enum VbAppWinStyle
Enumerands
vbHide 0
vbNormalFocus 1
vbMinimizedFocus 2
vbMaximizedFocus 3
vbNormalNoFocus 4
vbMinimizedNoFocus 6
Status Implemented
Module Constants
See also Shell
Enum VbCalendar
Enumerands
vbCalGreg 0
vbCalHijri 1
Status Implemented
Module Constants
See also Calendar
Enum VbCallType
Enumerands
vbMethod 1
vbGet 2
vbLet 4
vbSet 8
Status Implemented
Module Constants
See also CallByName
Enum VbCompareMethod
Enumerands
vbCompareBinary 0
vbCompareText 1
Status Implemented
Module Constants
See also Filter, InStr, Replace, Split, StrConv
Enum VbDateTimeFormat
Enumerands
vbGeneralDate 0
vbLongDate 1
vbShortDate 2
vbLongTime 3
vbShortTime 4
Status Implemented
Module Constants
See also FormatDateTime
Enum VbDayOfWeek
Enumerands
vbUseSystemDayOfWeek 0
vbSunday 1
vbMonday 2
vbTuesday 3
vbWednesday 4
vbThursday 5
vbFriday 6
vbSaturday 7
Status Implemented
Module Constants
See also DateDiff, Format, Weekday, WeekdayName
Enum VbFileAttribute
Enumerands
vbNormal 0
vbReadOnly 1
vbHidden 2
vbSystem 4
vbVolume 8
vbDirectory 16
vbArchive 32
vbAlias 64
Status Implemented
Module Constants
See also Dir, GetAttr, SetAttr
Enum VbFirstWeekOfYear
Enumerands
vbUseSystem 0
vbFirstJan1 1
vbFirstFourDays 2
vbFirstFullWeek 3
Status Implemented
Module Constants
See also DateDiff, Format
Enum VbIMEStatus
Enumerands
vbIMEModeNoControl, vbIMENoOp 0
vbIMEModeOn, vbIMEOn 1
vbIMEModeOff, vbIMEOff 2
vbIMEDisable,vbIMEModeDisable 3
vbIMEHiragana,vbIMEModeHiragana 4
vbIMEKatakanaDbl,vbIMEModeKatakana 5
vbIMEKatakanaSng, vbIMEModeKatakanaHalf 6
vbIMEAlphaDbl, vbIMEModeAlphaFull 7
vbIMEAlphaSng, vbIMEModeAlpha 8
vbIMEModeHangulFull 9
vbIMEModeHangul 10
Status Implemented
Module Constants
See also IMEStatus
Enum VbMsgBoxStyle
Enumerands
vbOKOnly 0
vbOKCancel 1
vbAbortRetryIgnore 2
vbYesNoCancel 3
vbYesNo 4
vbRetryCancel 5
vbCritical 16
vbQuestion 32
vbExclamation 48
vbInformation 64
vbDefaultButton1 0
vbDefaultButton2 256
vbDefaultButton3 512
vbDefaultButton4 768
vbApplicationModal 0
vbSystemModal 4096
vbMsgBoxHelpButton 16384
vbMsgBoxSetForeground 65536
vbMsgBoxRight 524288
vbMsgBoxRtlReading 1048576
Status Implemented
Module Constants
See also MsgBox
Enum VbMsgBoxResult
Enumerands
vbOK 1
vbCancel 2
vbAbort 3
vbRetry 4
vbIgnore 5
vbYes 6
vbNo 7
Status Implemented
Module Constants
See also MsgBox
Enum VbStrConv
Enumerands
vbUpperCase 1
vbLowerCase 2
vbProperCase 3
vbWide 4
vbNarrow 8
vbKatakana 16
vbHiragana 32
vbUnicode 64
vbFromUnicode 128
Status Implemented
Module Constants
See also StrConv
Enum VbTriState
Enumerands
vbUseDefault -2
vbTrue -1
vbFalse 0
Status Implemented
Module Constants
See also FormatCurrency, FormatNumber, FormatPercent
Enum VbVarType
Enumerands
vbEmpty 0
vbNull 1
vbInteger 2
vbLong 3
vbSingle 4
vbDouble 5
vbCurrency 6
vbDate 7
vbString 8
vbObject 9
vbError 10
vbBoolean 11
vbVariant 12
vbDecimal 14
vbSByte 16
vbByte 17
vbUInteger 18
vbULong 19
vbLongLong 20
vbULongLong 21
vbUserDefinedType 36
vbLongPtr 37
vbArray 8192
Status Implemented
Module Constants
See also VarType