Visual BIASC function speed check

xiaoxiao2021-03-06  101

Calendar constant

The following constants can be used in place anywhere in the code:

The constant value describes that vbCalgReg0 pointed out that the product calendar is used. Vbcalhijri1 pointed out that the Islamic calendar is used.

COLOR constant

The following constants can be used in place anywhere in the code:

Constant value description VBLACK0X0 black vbred0xff red vbgreen0xff00 green vbyellow0xfffffffffff yellow vblue0xff0000 blue vbmagenta0xff00ff purple vbcen0xffff00 cyan vbwhite0xffffffff

Comparison constant

The following constants are defined by the type library in Visual Basic for Applications that can be used to replace the actual value anywhere in the code:

Constant Value Description VbuseCompareOption-1 compares the settings of the Option Compare statement. VbbonaryCompare0 performs binary comparison. VbTextCompare1 is compared to the text. VBDatabaseCompare2 is used for Microsoft Access (Windows only), making comparisons based on the information included in the database.

Compiler constant

Visual Basic for Applications defines some constants that cannot be used with #if ... the ... # Else instruction. These constants are globally in addition to their scope; that is, in addition to being applied everywhere, the constant is functionally defined with the #IF ... Then ... # Else command.

On the 16-digit development platform, the compilation constant is defined as follows:

Constant value description Win16TRUE points out that the development environment is 16 bits. Win32false pointed out that the development environment is not 32 bits.

On the 32-bit development platform, the compilation constant is defined as follows:

Constant value description Win16False pointed out that the development environment is not 16 bits. Win32true points out that the development environment is 32.

Date constant

The following constants can be used in place anywhere in the code:

Parameter value

The firstdayofweek parameter has the following values:

The constant value describes VbuseSystem0 Use the NLS API settings. Vbsunday1 Sunday (default) VBMonday2 Monday VBTESDAY3 Tuesday VBwednesday Wednesday VBTHURSDAY5 Thursday Vbfriday6 Friday VBSATURDAY7 Saturday

The firstdayofyear parameter has the following values:

The constant value describes VbuseSystem0 Use the NLS API settings. VbuseSystemDayofweek0 uses the number of days specified in the first day of the week. VBFirstjan11 starts the week of January 1 (default). VBFirstFourDays2 starts at least 4 days from the new year. VBFirstfulWeek 3 starts the first complete week in the year.

return value

Constant value description VBSunday1 Sunday vbmonday2 Monday VBTESDAY3 Tuesday VBwednesday Wednesday VBTHURSDAY5 Thursday Vbfriday6 Friday VBSATURDAY7 Saturday

Date format constant

These constants can only be used when your project has an explicit reference to the corresponding type library that contains these constant definitions.

Constant value describes VBGeneLDate0 displays date and / or time. For a real number, display date and time. If there is no fraction, only the date is displayed. If there is no integer part, only the time is displayed. Date and time display is determined by the system setting value. VBlongDate1 displays the date with the long-term format specified by the computer area setting value. VBShortDate2 Displays the date with the short date format specified by the computer area setting value. VblongTime3 displays time with a long-time format specified by a computer zone setting value. VBShostTime4 Displays time with a short time format specified by the computer zone setting value.

DIR, GetAttr and SetAttr constants can replace the actual value anywhere in the code:

Constant Value Description VBNORMAL0 Normal (DIR and Setattr's Default) VBReadonly1 read-only VBHIDDEN2 hidden VBSystem4 system file vbvolume8 volume wizard vbarchive32 file has changed since the last backup

Drive type constant

These constants can only be used when your project has an explicit reference to the corresponding type library that contains these constant definitions.

The constant value describes that unknown0 cannot determine the drive type. The REMOVABLE1 drive has a delete medium. Includes all floppy drives and many other types of storage devices. The Fixed2 drive has a fixed medium (not removed). Includes all hard drives within the hard disk. Remote3 network drive. A drive that can be shared anywhere on the network. The CDROM4 drive is a CD-ROM. Includes read-only CD-ROM and readable writable CD-ROM. The RAMDISK5 driver is a random access memory (RAM) on the local computer, which works like a disk drive.

File attribute constant

These constants can only be used when your project has an explicit reference to the corresponding type library that contains these constant definitions.

A constant value describes Normal0 normal files. No properties are set. Readonly1 read-only files. Attributes are readable / written. Hidden2 hidden files. Attributes are readable / written. System4 system file. Attributes are readable / written. Volume8 Disk drive scroll. Attributes are read-only. Directory16 folder or directory. Attributes are read-only. Archive32 has changed from the last backup. Attributes are readable / written. Alias64 links or shortcuts. Attributes are read-only. Compressed128 compressed files. Attributes are read-only.

File input / output constant

These constants can only be used when your project has an explicit reference to the corresponding type library that contains these constant definitions.

Constant value description Forreading1 Opens files for read-only operations. You cannot write a file. ForWriting2 Opens the file for write operations. If there is a file with the same file name, the original content of the file is overwritten. FORAPPENDING8 opens the file and writes to the end of the file.

DIR, GETATTR and SETATTR constants?

The following constants can be used in place anywhere in the code:

Constant Value Description VBNORMAL0 Normal (DIR and Setattr's Default) VBReadonly1 read-only VBHIDDEN2 hidden VBSystem4 system file vbvolume8 volume wizard vbarchive32 file has changed since the last backup

Imestatus constant

The following constants can be used instead of the actual value anywhere in the code.

The constants of Japanese countries are as follows:

Constants described vbIMEModeNoControl0 not installed IME (default) vbIMEModeOn1 IMEvbIMEModeOff2 opening closed IMEvbIMEModeDisable3 invalid IMEvbIMEModeHiragana4 full width Hiragana Katakana mode vbIMEModeKatakana5 the full width of half width Katakana mode vbIMEModeKatakanaHalf6 mode vbIMEModeAlphaFull7 full width half width Alphanumeric mode Alphanumeric mode vbIMEModeAlpha8

The constants in Korea are as follows:

Constant value description

VbimeModealphafull7 full width alphaumeric mode

VbimeModealpha8 semi-width alphaumeric mode

VbimeModeHangulfull9 complete width HANGUL mode

VbimeModeHangul10 Half Width HANGUL Mode

The constant values ​​in the Chinese area are as follows:

Constant value description

VbimeModenoControl0 does not have IME (default) VbimeModeon1IME open

VbimeModeoff2ime OFF

Keycode constant

The following constants can be used in place anywhere in the code:

Constants described vbKeyLButton0x1 left mouse button vbKeyMButton0x4 vbKeyRButton0x2 right-mouse button vbKeyCancel0x3CANCEL vbKeyBack0x8BACKSPACE key vbKeyTab0x9TAB key vbKeyClear0xCCLEAR key vbKeyReturn0xDENTER key vbKeyShift0x10SHIFT key vbKeyControl0x11CTRL key vbKeyMenu0x12MENU key vbKeyPause0x13PAUSE key vbKeyCapital0x14CAPS LOCK key vbKeyEscape0x1BESC key vbKeySpace0x20SPACEBAR key vbKeyPageUp0x21PAGE UP key vbKeyPageDown0x22PAGE DOWN key vbKeyEnd0x23END key vbKeyHome0x24HOME key vbKeyLeft0x25LEFT ARROW key vbKeyUp0x26UP ARROW key vbKeyRight0x27RIGHT ARROW key vbKeyDown0x28DOWN ARROW key vbKeySelect0x29SELECT key vbKeyPrint0x2APRINT SCREEN key vbKeyExecute0x2BEXECUTE key vbKeySnapshot0x2CSNAPSHOT key vbKeyInsert0x2DINSERT key vbKeyDelete0x2EDELETE key vbKeyHelp0x2FHELP key vbKeyNumlock0x90NUM LOCK key

The A to Z keys are the same as the ASCII code of the A - z letters:

Constants described vbKeyA65A key vbKeyB66B key vbKeyC67C key vbKeyD68D key vbKeyE69E key vbKeyF70F key vbKeyG71G key vbKeyH72H key vbKeyI73I key vbKeyJ74J key vbKeyK75K key vbKeyL76L key vbKeyM77M key vbKeyN78N key vbKeyO79O key vbKeyP80P key vbKeyQ81Q key vbKeyR82R key vbKeyS83S key vbKeyT84T key vbKeyU85U key vbKeyV86V key vbKeyW87W key vbKeyX88X Key VBKEYY89Y key VBKEYZ90Z key

0 to 9 keys are the same as the number 0 - 9 ASCII code:

Constant value description VBKEY0480 key VBKEY1491 key VBKEY2502 key VBKEY3513 key VBKEY4524 key VBKEY5535 key VBKEY6546 key VBKEY7557 key VBKEY8568 key VBKEY9579 key

The following constants represent the keys on the numeric keypad:

Constants described vbKeyNumpad00x600 key vbKeyNumpad10x611 key vbKeyNumpad20x622 key vbKeyNumpad30x633 key vbKeyNumpad40x644 key vbKeyNumpad50x655 key vbKeyNumpad60x666 key vbKeyNumpad70x677 key vbKeyNumpad80x688 key vbKeyNumpad90x699 key vbKeyMultiply0x6AMULTIPLICATION SIGN (*) key vbKeyAdd0x6BPLUS SIGN ( ) key vbKeySeparator0x6CENTER key vbKeySubtract0x6DMINUS SIGN (-) (.) Key vbKeyDecimal0x6EDECIMAL POINT key vbKeyDivide0x6FDIVISION SIGN (/) button

The function keys following constants: Constant Value Description vbKeyF10x70F1 key vbKeyF20x71F2 key vbKeyF30x72F3 key vbKeyF40x73F4 key vbKeyF50x74F5 key vbKeyF60x75F6 key vbKeyF70x76F7 key vbKeyF80x77F8 key vbKeyF90x78F9 key vbKeyF100x79F10 key vbKeyF110x7AF11 key vbKeyF120x7BF12 key vbKeyF130x7CF13 key vbKeyF140x7DF14 vbKeyF150x7EF15 key button key vbKeyF160x7FF16

Miscellaneous constant

The following constants are defined by the type library in Visual Basic for Applications that can be used to replace the actual value anywhere in the code:

Constant is equal to describing VBCRLFCHR (13) CHR (10) Enter The new line character specified by the VBCRCHR (13) Enter VBLFCHR (10) Entering VBNewLinechr (13) CHR (10) Platform; suitable for The current platform VBnullCharchr (0) value of the character vbnullstring value is 0 strings to call external processes; string ("") with length zero ("") Different VBObjectError-2147221504 user-defined error numbers should be greater than this value, for example, : Err.raise Number = VBObjectError 1000Vbtabchr (9) Tab word. Vbbackchr (8) Elavor character vbformfeedchr (12) There is no effect in Microsoft Windows Vbvert-Tabchr (11) does not work in Microsoft Windows.

MSGbox constant

The following constants can be used anywhere in the code instead of the actual value:

MSGBOX parameters

The constants described vbOKOnly0 only the OK button (default value) vbOKCancel1OK and Cancel buttons vbAbortRetryIgnore2Abort, Retry, and Ignore buttons vbYesNoCancel3Yes, No, and Cancel buttons vbYesNo4Yes and No buttons vbRetryCancel5Retry and Cancel buttons vbCritical16 critical messages vbQuestion32 warning message asking vbExclamation48 warning notification message vbInformation64 The first button of VBDefaultButton10 is the default (default) VBDEFAUTBUTTON2256 second button is the default VBDefaultButton3512 third button is the default VBDEFAUTBUTTON4768 fourth button is a message box for the default VBApplicationModal0 application form. message box (missing) Province value) vbSystemModal4096 system vbMsgBoxHelpButton16384 forced back message box Help button to add the specified message block VbMsgBoxSetForeground65536 message box window as the foreground window is right-justified text vbMsgBoxRight524288 vbMsgBoxRtlReading1048576 specified in Hebrew and Arabic systems, the text should be displayed to the right To the left

MSGBOX return value

Constant Value Description VBOK1 Press the OK button Vbcancel2 Press the CANCEL button Vbabort3 Press the Abort button vbretry4 Press the Retry button vbignore5 Press the IGNORE button Vbyes6 Press the YES button VBNO7 Press the NO button.

QueryClose constant

The following constants can be used for any location in the code instead of the actual value:

Constant Value Description VBFormControlMenu0 Users Select the Close command from the Control menu on the form. The VBFormCode1UnLoad statement is called from the code. VBAppWindows2 The current Microsoft Windows operating environment session ends. VbapptaskManager3Windows Task Manager is closing the app. DIR, GETATTR and SETATTR constants?

The following constants can be used in place anywhere in the code:

Constant Value Description VBNORMAL0 Normal (DIR and Setattr's Default) VBReadonly1 read-only VBHIDDEN2 hidden VBSystem4 system file vbvolume8 volume wizard vbarchive32 file has changed since the last backup

Shell constant

The following constants can be used anywhere in the code instead of the actual value:

The constant value describes the VBHIDE0 window is hidden and the focus is passed to the hidden window. The VBNORMALFOCUS1 window has focus and is restored to the original size and location. The VBMinimizedFocus2 window is reduced as icons and has focus. The VBMaximizedFocus3 window maximizes and owns the focus. The VBNORMALNOFOCUS4 window is restored to the last size and location. The current active window is still an active window. The VBMinimizenofocus6 window is reduced as icon. The current active window is still an active window.

Special file clamp

These constants can only be used when your project has an explicit reference to the corresponding type library that contains these constant definitions.

The constant value describes the WindowsFolder0Windows folder contains files installed by the Windows operating system. The SystemFolder1System (System) folder contains libraries, fonts, and device drivers. TempoRyFolder2Temp is used to store temporary files. Its path can be found in the TMP environment variable.

STRCONV constant

The following constants can be used anywhere in the code instead of the actual value:

Constant Value Description VBupPercase1 converts a string to a capital character. vblowercase2 converts a string into a lowercase character. VBPropercase3 converts the first letter of each word in the string to uppercase. VBWIDE4 converts the narrow (single-byte) character in the string into a wide (double-byte) character. Suitable for Far East. VBNARROW8 converts the width (double byte) character in the string into a narrow (single-byte) character. Suitable for Far East. VBKATAKANA16 converts the Hiragana characters in the string into katakana characters; only applicable to Japanese areas. Vbhiragana32 converts Katakana characters in the string into hiragana characters; only applicable to Japanese areas. Vbunicode64 converts strings into unicode with the default system code page. VBFromunicode 128 converts strings by Unicode into default system code pages.

System Color constant

The following constants can be used in place anywhere in the code:

The constants described in the title bar color vbScrollBars0x80000000 scrollbar color vbDesktop0x80000001 desktop color vbActiveTitleBar0x80000002 active window vbInactiveTitleBar0x80000003 inactive window's title bar colors vbMenuBar0x80000004 menu background color vbWindowBackground0x80000005 window background color vbWindowFrame0x80000006 window frame color vbMenuText0x80000007 menu text color vbWindowText0x80000008 window text color vbTitleBarText0x80000009 title, adjust the frame the selected item and text color vbActiveBorder0x8000000A active window border scroll arrows color vbInactiveBorder0x8000000B background color vbHighlight0x8000000D control inactive window border color vbApplicationWorkspace0x8000000C Multiple document interface (MDI) application selected item background color vbHighlightText0x8000000E control text color vbButtonFace0x8000000F command buttons shaded surface color vbButtonShadow0x80000010 command button vbGrayText0x80000011 edge shadow color gray (disabled) text under the text color vbInactiveCaptionText0x80000013 vbButtonText0x80000012 push button inactive caption text color vb3DHighlight0x800000143-D display element highlight color vb3DDKShadow0x800000153-D show the deepest shadow color than the brightest element vb3DLight0x80000016vb3Dhighlight 3 -D color vbinfotext0x80000017 Tools Tips text color vbinfoBackground0x80000018 Tools prompt background color tri-state constant

These constants can only be used when your project has an explicit reference to the corresponding type library that contains these constant definitions.

Constant value description TristateTrue-1 TruetristateFalse0FalSetriStateUsesedefault-2 uses the default setting value.

VARTYPE constant

The following constants can be used in place anywhere in the code:

Constants described vbEmpty0 uninitialized (default) vbNull1 does not contain any valid data vbInteger2IntegervbLong3 Long vbSingle4 vbDouble5 single precision floating point double precision floating point error vbBoolean11 vbCurrency6CurrencyvbDate7DatevbString8StringvbObject9 objects vbError10 Boolean vbVariant12Variant (only for array types variant) vbDataObject13 data access Object vbdecimal14decimalvbbyte17bytevbuserDefinedType36 Contains VBARRAY8192 array of user-defined types

Visual Basic constant

Visual Basic for Applications defines some constants to make programming easier. The following constants can replace the actual value anywhere in the program code:

Calendar constant

COLOR constant

Compiler constant

Date constant

DIR, GetAttr and SetAttr constants

Imestatus constant

INSTR, STRComp constant

Keycode constant

Miscellaneous constant

MSGbox constant

QueryClose constant

QueryClose constant

Shell constant

STRCONV constant

System Color constant

VARTYPE constant

Boolean data type

The Boolean variable is stored as 16-bit (2 bytes) numerical form, but it can only be TRUE or FALSE. The value of the Boolean variable is displayed as True or False (when using Print), or # true # or # false # (when using Write #). Use Keyword true with false to assign a Boolean variable to one of these two states. When converting other numeric types of Boolean, 0 will turn into false, while other values ​​becomes True. When the conversion Boolean value is other data type, FALSE becomes 0, and TRUE becomes -1.

BYTE data type

The BYTE variable is stored as single precision type, no symbol integer, 8-bit (1 byte) value, range between 0 and 255.

Byte data type is useful when storing binary data.

Currency data type

The Currency variable is stored as a 64-bit (8 byte) integer form, then divided by 10,000 to give a fixed point number, there are 15 digits on the left side of the decimal point, and there are 4 digits on the right. Such representations range from -922, 337, 203, 685, 477.5808 to 922, 337, 203, 685, 477.5807. Currency's type declaration character is AT number (@).

The Currency data type is useful in currency computing and fixed-point calculations, and it is particularly important in this case.

Date data type

The Date variable is stored as the IEEE 64-bit (8 bytes) floating point numerical form, which can represent the date range from January 1 to December 31, 9999, while time can range from 0:00:00 to 23 : 59: 59. Any identifiable text date can assign a value to the Date variable. Date text must be extended in a number symbol (#), for example, # january 1, 1993 # or # 1 jan 93 #.

The DATE variable will be displayed according to the short date format in the computer. Time is displayed according to the computer's time format (12 or 24 hours).

When other numerical types are converted to a Date type, the values ​​on the left side of the decimal point represent the date information, and the value on the right side of the decimal point indicates time. The midnight is 0 and the noon is 0.5. The negative integer represents the date before December 30, 1899.

Decimal data type

The DECIMAL variable is stored as 96-bit (12 bytes) unsigned integer forms and divided by a 10 power number. This ratio determines the number of digital bits on the right side of the decimal point, which ranges from 0 to 28. The maximum possible value is /- 79, 228, 162, 514, 264, 337, 593, 543, 950, 335 for the ratio of 0 (without a few). In the case of 28 small digits, the maximum is /- 7.9228162514264337593543950335, the smallest non-zero value is /- 0.0000000000000000000000000001.

Note that the DECIMAL data type can only be used in Variant, that is, a variable cannot be declared as the type of Decimal. However, you can create a subtype of Decimal using a CDEC function.

Double data type

Double (Double Precision Floating Point) variable is stored as an IEEE 64-bit (8 byte) floating point value, its range is from -1.7976313486232E308 to -4.94065645841247E-324, while positive It is from 4.947E-324 to 1.79769313486232e308. Double type declaration characters are numbers (#). Integer data type

The Integer variable is stored as 16-bit (2 bytes), with between -32, 768 to 32, 767. Integer's Type Declaration Character is percentage symbol (%).

You can also use an Integer variable to represent an enumerated value. The enumeration value can include a limited set that includes the elements of the collections being an integer, and each integer has its own special meaning during its context. The enumeration value provides a convenient method for making a selection in a known quantity option, for example, Black = 0, White = 1, etc. A preferred programming method is to define each enumerated value into a constant using the const statement.

Long data type

Long (long integer) variable is stored as a 32-bit (4 bytes) having a symbolic form, which ranges from -2, 147, 483, 648 to 2, 147, 483, 647. LONG type declaration character is and numbered (&).

Object data type

The Object variable is stored as a 32-bit (4 byte) address form, which is a reference to the object. With the SET statement, the variable that is declared as Object can assign a reference to any object.

Note Although the variables declared in an Object type is sufficient to accommodate references to the various objects, the object bound to the variable is always binded to the late stage (running). To force an early (compile time) binding, you must assign the reference to the object to the variable declared by the specific class name.

Single data type

SINGLE (single-precision floating point) variable is stored as the form of IEEE 32-bit (4 bytes) floating point value, its range is from -3.402823E38 to -1.401298E-45 when negative, while positive It is from 1.401298E-45 to 3.402823E38. Single Type Declaration Character is an exclamation mark (!).

String data type

There are two strings: the string of long and fixed length.

The bell string can contain approximately 2 billion (2 ^ 31) characters. The fixed length string can contain 1 to about 64K (2 ^ 16) characters.

Note that the public minimum string cannot be used in the class module.

The range of String is 0 to 255. The first 128 characters of the character set (0 to 127) correspond to the characters and symbols on the standard U.S. keyboard. The first 128 characters are the same as defined in the ASCII character set. After 128 characters (128 to 255) represent special characters, such as international characters, stress symbols, currency symbols, and scores. String type declaration character is the US or Dollar number ($).

User defines data type

Can be any data type defined with the Type statement. The user-defined type can contain one or more data types of data elements, arrays, or a previously defined user-defined type. E.g:

Type mytype

MyName As String 'Defines a string variable to store a name.

MyBIRTHDATE AS DATE 'Defines a date variable to store a birthday.

Mysex as integer 'Defines the integer variable storage gender

End type '(0 is female, 1 for male) Variant data type

The Variant data type is all data types that are not explicitly declared (with statements such as DIM, PRIVATE, PUBLIC, or STIC, etc.). The Variant data type does not have a type declaration character.

Variant is a special data type, in addition to the length String data and user-defined types, any kind of data can be included. Variant can also contain special values ​​such as EMPTY, ERROR, NOTHING, and NULL. You can use the VARTYPE function or the Typename function to determine how data in variant is handled.

Numerical data can be any integer or real shape, and the number of negative numbers range from -1.79763134862315E308 to -4.94066E-324, from 4.94066E-324 to 1.797693134862315E308. Typically, numerical Variant data remains the original data type in Variant. For example, if you assign an Integer to Variant, the next endor will handle this Variant as an Integer. However, if the arithmetic operation is performed on a Variant containing one of Byte, Integer, Long or Single, and when the result exceeds the normal range of the original data type, the results in Variant will increase to a larger data type. If BYTE is upgraded to Integer, Integer is upgraded to long, while long and single are upgraded to Double. An error occurs when there is currency, decimal, and double values ​​in the Variant variable exceeding their respective ranges.

You can replace any data type with a Variant data type, which is more adaptable. If the content of the Variant variable is a number, it can use a string to represent the number or in the actual value, which will be determined by the context, for example:

Dim Myvar as Variant

Myvar = 98052

In the previous example, there is an actual value of 98052 in MyVar. As expected, the arithmetic operator can operate on the Variant variable, including a value or a string data that can be interpreted as a value. If you use a operator to add MYVAR to other variables that contain numbers containing numbers, the result is an arithmetic and.

The EMPTY value is used to mark the Variant variable that has not been initially (given the initial value). Variant containing EMPTY represents 0 in the context of the value, and if it is used in the context of the string, the zero length string (") is indicated.

Empty should not be mixed with NULL. NULL is that the variant variable does contain an invalid data.

In Variant, Error is used to indicate a special value when an error occurs during the process. However, unlike other types of errors, the program does not produce an ordinary application-level error handling. This allows the programmer, or the application itself, according to this error value. You can use the CVERR function to convert the real number to the error value to generate an Error value.

#Const instruction

Use to define the conditional compilation constant of Visual Basic.

grammar

#Const constname = expression

The syntax of the #const compile instruction has the following sections:

Partial Description constname is necessary; Variant (string). Constant; name to comply with variable names. EXPRESSION is necessary. Text, other conditional compilation constants or any combination of arithmetic or logical operators other than IS. Description

Condition Compilation Constants is always private in the modules they appear. It is impossible to establish a public compilation constant using a #const directive. Public compilation constants can only be established in a user interface.

Compiling constants and text can only be used in Expression. Using a standard constant defined with const, or using an undefined constant, it will cause errors. Conversely, the constant defined with #const keyword can only be used for conditional compilation.

Regardless of the position of the conditional compilation constant in the program, it is always calculated in the module level.

#If ... Then ... # else instruction

Conditional compiled Visual Basic Code Blocks.

grammar

#If expression thein

Statements

[#ELSEIF Expression-N Then

[elseifStatements]]]]]]

[#Else

[ElseStatements]]]

#End IF

#If ... The syntax of the instruction has the following sections:

Partially describing Expression is necessary. Contains one or more conditions compiling constants, any expression of the text and operator, which is TRUE or FALSE. STATEMENTS is necessary. Visual Basic line or compiling instructions, if the associated expression is TRUE, run them. Expression-n is optional. Any expression composed of one or more conditions compiled constants, text, and operators, which is True or False. ElseIfStatements is optional. One or more lines or compile commands, if Expression-N is TRUE, run them. ElseStatements is optional. One or more procedures or compile commands, if there is no TRUE in previous expression or expression-n, run them.

Description

#If ... Then ... # Else The role of the instruction is the same as if ... then ... Else statement, the difference is # ix, # else, # elseif, and the #END IF instruction does not have a separate form of a row. That is, in the line where the instruction is located, there must be no other code. Conditional compilation is often used to compile the same program on different platforms. It can also be used to avoid debugging code in the executable. The program code that is excluded when compiled is completely omitted in the final executable, so it does not have any effects of the size or function of the program.

Regardless of the results, all expressions must be calculated. Therefore, all constants used in the expression must be defined - any undefined constant will be used as EMPTY to calculate the value.

Note that the OPTION COMPARE statement does not affect the expression in the #IF and #elseif statement. The expression in the conditional compilation instruction is always calculated using the Option Compare Text.

ABS function

The absolute value of the parameter is returned, and its type and parameter are the same.

grammar

ABS (Number)

The necessary NUMBER parameters are any valid numerical expression. If Number contains NULL, return null if Number is an uninited variable, returns 0.

Description

A number of absolute values ​​is to remove the positive and negative numbers. For example, both ABS (-1) and ABS (1) are returned to 1.

Array function

Returns a Variant that contains arrays.

grammar

Array (arglist)

The required ArgList parameter is a value separated by a comma that assigns values ​​to each element of the array contained in Variant. If you do not provide parameters, create an array of length 0.

Description

The symbols used to represent array elements consist of the index number of the variable name, parentheses, and the desired elements in parentheses. In the example below, the first statement creates a variant variable A. The second statement assigns a number to the variable A. The last statement assigns the value of the second element of the array to another variable. Dim a as variant

A = array (10, 20, 30)

B = a (2)

The lower bound of array created using the Array function is determined by the lower boundary specified by the Option Base statement unless Array is limited by the type library (eg, VBA.Array). If it is limited by the type library name, Array is not affected by Option Base.

Note that there is no VARIANT as an array declaration or an array. In addition to the length fixed string and the user-defined type, Variant variables can represent any type of array. Although a Variant and an element that contain array are Variant types, the access method of array elements is the same.

ASC function

Returns an Integer, representing the character code of the first letter in the string.

grammar

ASC (String)

The necessary String parameters can be any valid string expression. If there is no character in the String, a runtime error is generated.

Description

Under the non-DBCS system, the return value ranges from 0 to 255. Under the DBCS system, it is -32768 - 32767.

Note that the ASCB function acts on byte data contained in the string, and ASCB returns the character code of the first byte, rather than character code. The ASCW function returns the Unicode character code. If the platform does not support Unicode, the same is the same as the ASC function.

ATN function

Returns a Double, specifying an interpretation of an unstextable value.

grammar

ATN (Number)

The necessary Number parameters are a Double or any valid numerical expression.

Description

The parameter value of the ATN function is the ratio of the right triangular triangle and returns an angle in an arc. This ratio is the neighbor of the neighbor length of the angle to the angle.

The value ranges between -Pi / 2 and Pi / 2 radians.

In order to convert the angle to an arc, multiply the angle with PI / 180. In order to convert the arc to an angle, multiply the arc by 180 / pi.

Note that ATN is the TAN's anti-triangular function, TAN's parameter value is angle, returns the ratio of two sides of the right angle triangle. Do not confuse the ATN and the remaining finishes, the remaining function value is the countdown of the positive cut function value, cotangent = (1 / tangent).

CallbyName function

Perform an object's method or set or return an attribute of an object.

grammar

CallbyName (Object, ProcedureName, CallType, [arguments ()])

The syntax of the CallByname function has the following sections:

Partially describes the necessary of Object; variant type (object). The function of the object will be executed. ProcedureName must be required; variant type (string). A string expression containing the attribute name or method name of the object. CallType must be; constant. A constant of a vbCallType type represents the type of process being called. Arguments () optional: Variable body (array).

Description

The CallByname function is used to get or set an attribute, or use a string name when running to call a method.

In the following example, the first line uses CallByname to set the mousepointer property of a text box, the second line gets the value of the mousepointer property, the third line calls the Move method to move the text box: CallbyName Text1, "MousePointer", Vblet, Vbcrosshair

Result = CallbyName (Text1, "Mousepointer", VBGET)

CallbyName Text1, "Move", VBMethod, 100, 100

Choose functions

Select and return a value from the parameter list.

grammar

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

The syntax of the Choose function has the following parts:

Some describe the INDEX necessary parameters, numerical expressions, or fields, and its calculation results are a value and bound between 1 and optional items. Choice Essential parameters, Variant expressions, one of them contains options.

Description

Choose will return a value in the selection list according to the value of Index. If Index is 1, Choose will return the first selection in the list. If Index is 2, the second selection item in the list will be returned to push it in this class.

You can use Choose to view items in a list. For example, if the value specified by Index is 3, while choice-1 = "one", choice-2 = "two", and choice-3 = "three", then Choose will return "Three". This feature will be particularly useful when Index represents the value in a group group.

Even if it only returns an option value, Choose will still calculate each selection in the list. So you should pay attention to this side effect. For example, when the MSGBox function is used in each of the selected items as part, a message box is displayed for each of the selected items.

When INDEX is less than 1 or greater than the number of selected items, the Choose function returns NULL.

If Index is not an integer, you will first go out to be an integer closest to it.

CHR function

Returns String, which contains characters related to the specified character code.

grammar

CHR (Charcode)

The necessary Charcode parameters is a Long used to identify a character.

Description

The numbers between 0 to 31 are the same as the standard non-print ASCII code. For example, CHR (10) can return a wrap character. The normal range of Charcode is 0-255. However, in the DBCS system, the actual range of Charcode is -32768 to 65535.

Note that the ChRB function acts on byte data contained in String. Chrb always returns a single byte instead of returning a character, a character may be one or two bytes. The Chrw function returns a string containing Unicode. If there is not supported the Unicode platform, its function is the same as the CHR function.

COMMAND function

Returns the parameter portion of the command line, which is used to load the executable developed by Microsoft Visual Basic or Visual Basic.

grammar

Command

Description

When using Visual Basic from a command line, any part of the command line after / cmd is passed to the program as the parameter of the command line. In the following example, cmdlineargs represents the parameter information returned by the Command function. VB / cmd cmdlineargs

For applications developed and compiled into .exe files using Visual Basic, Command returns any parameters that appear after the application name in the command line. E.g:

MyApp CMDLINEARGS

Want to know how to change the command line parameters in the user interface of the application being used, please search for the help of "command line parameters".

COS function

Returns a double, specifying the cosine value of a corner.

grammar

Cos (Number)

The necessary NUMBER parameters are a double or any valid numerical expression indicating a angle in an arc.

Description

The parameter of the COS function is a corner and returns the ratio of the upper side triangle. This ratio is the neighbor length of the angle divided by the length of the beveled.

The results range from -1 to 1.

In order to convert the angle into an arc, multiply the angle with PI / 180. In order to convert the arc to an angle, multiply the arc at 180 / Pi.

CreateObject function

Create and return a reference to the ActiveX object.

grammar

CreateObject (Class, [ServerName])

The syntax of the CreateObject function is as follows:

Partially describes the required Class necessary; Variant (String). The application name and class you want to create. ServerName is optional; Variant (string). To create a web server name of an object.

The class parameter uses AppName.ObjectType this syntax, including the following sections:

Partially describes Appname necessary; Variant. Provides the application name of this object. ObjectType must be required; Variant. Type or class to be created.

Description

Each support automated application provides at least one object type. For example, a word processing application may provide an Application object, a Document object, and a Toolbar object.

To create an ActiveX object, simply assign the object returned by CreateObject to an object variable:

'Declare an object variable to store the object

'Reference. DIM As Object uses a later binding method.

DIM EXCELSHEET AS Object

SET EXCELSHEET = CREATEOBJECT ("Excel.sheet")

The above code will start the application to create the object, in this example, you create a Microsoft Excel electronic data table. Once the object is created, you can use a custom object variable in your code to reference the object. In the following example, object variables Excelsheet can be used to access the properties and methods of the new object, and other objects accessing Microsoft Excel, including application objects and cell collections.

'Set the Application object to make Excel visible

Excelsheet.Application.visible = TRUE

'Write some text in the first unit of the table

Excelsheet.cells (1, 1) .value = "this is colorn a, row 1"

'Save the table to the C: / Test.doc directory

Excelsheet.saveas "C: / Test.doc"

'Close Excel using the Quit method of the application object.

Excelsheet.Application.quit 'Releases the object variable

SET EXCELSHEET = Nothing

Use the AS Object clause to declare an object variable, you can create a variable that can contain any type of object reference. However, this variable access object is an late binding, that is, binding is done at runtime. To create an object variable using the previous binding mode, that is, the binding is completed when the program is compiled, and the object variable should be specified when the class ID is declared. For example, you can declare and create the following Microsoft Excel references:

DIM XLAPP as Excel.Application

DIM XLBOOK AS Excel.Workbook

DIM Xlsheet as Excel.Worksheet

Set XLAPP = CreateObject ("Excel.Application")

Set xlbook = xlapp.workbooks.add

Set xlsheet = xlbook.worksheets (1)

The previously bound variable reference can provide better performance, but this variable can only store references for classes specified in the declaration.

You can pass the object returned by the CreateObject function to a function of a parameter as an object. For example, the following code creates and passes a reference to an Excel.Application object:

Call MySub (CreateObject ("Excel.Application"))

You can create an object on a remote network computer, and the method is to pass the name of the computer to the ServerName parameter of the CreateObject. This name is the same as the machine name of the shared name: ServerName parameters for a shared name "MyServer // PUBLIC" are "MyServer".

The following code returns the version number of the Excel instance running on a remote computer called MyServer:

DIM XLAPP As Object

Set xlapp = creteObject ("excel.application", "myserver")

Debug.print xlapp.version

If the remote server does not exist or unavailable, a runtime error occurs.

Note When the object is currently not an instance, CreateObject should be used. If the object already has an instance, a new instance is started and an object of a specified type is created. To use the current instance, or start the application and load a file, you can use the getObject function.

If the object is already registered as a single instance object, an instance of the object can only be created regardless of how many CreateObject executing is executed.

Curdir function

Returns a Variant (String) to represent the current path.

grammar

Curdir [(Drive)]

Optional DRIVE parameters are a string expression that specifies an existing drive. If no drive is specified, or Drive is a zero length string ("), Curdir returns the path to the current drive.

CVERR function

Returns the Variant of the ERROR sub-type, which contains the specified error number.

grammar

CVERR (ERRORNUMBER)

The necessary ErrorNumber parameters can be any valid error number code.

Description

You can use the CVERR function in the process to create a user-defined error. For example, if you create a function, it can accept several parameters, and return a string normally, and the function can be judged to determine the input parameters to confirm that they are within an acceptable range. If not, this function will not return the desired string. In this case, CVERR can return an error number and inform the action that should take. Note that ERROR implicit conversion is not allowed, for example, cannot assign a return value of CVERR to a non-VARIANT variable directly. However, the return value of CVERR can be explicitly converted (using CINT, CDBL, etc.) and assigns the appropriate data type variable.

Date function

Returns Variant (Date) containing the system date.

grammar

Date

Description

To set the system dates, use the Date statement.

DateAdd function

Returns Variant (Date) containing a date, this date is also added to a period of time.

grammar

Dateadd (Interval, Number, Date)

There is the following naming parameters in the DateAdd function syntax:

Some describe the interse necessary. String expressions are the time interval to be added. Number is necessary. Numerical expressions are the number of time intervals to be added. Its value can be positive (to get the date of the future), or a negative number (obtained past date). Date is necessary. Variant (Date) or a date of the date, this date is added with time intervals.

Set

The interval parameter has the following settings:

Set Description YYYY Year Q season M month Y Year day number D day W One week's day WW week h N minutes s second

Description

You can use the DATEADD function to add or subtract the specified time interval. For example, you can use dateAdd to calculate the date from today for 30 days; or the calculation is now 45 minutes.

In order to add "Day" to Date, "Day" ("Y"), "Day" ("D") or "Western Day" ("W").

The DateAdd function will not return the valid date. In the following examples, Plus January 31:

DateAdd (M, 1, 31-JAN-95)

In the above, DateAdd returned on February 28, 1995, not on February 31, 1995. If DATE is January 31, 1996, due to 1996, the return value was February 29, 1996.

If the calculated date exceeds the previous 100 years (subtractive annual years over Date), it will cause errors.

If NUMBER is not a long value, the closest integer value is taken when calculating.

Note that the format of the DATEADD return value is determined by the Control Panel setting, not by the format that passes to the DATE parameter.

Datediff function

Returns the value of Variant (long), indicating the number of time intervals during two specified days.

grammar

Datediff (Interval, Date1, Date2 [, Firstdayofweek [, Firstweekofyear]])

Datediff function syntax has the following naming parameters:

Some describe the interse necessary. String expressions indicating the time interval for calculating the time difference of DATE11 and DATE2; Variant (Date). The two dates to use in the calculation. Firstdayofweek is optional. Specifies the constant of the first day of a week. If you do not designate, the Sunday is the first day. Firstweekofyear is optional. Specifies the constant of the first week of one year. If not specified, the week is the first week of the week of January 1. Set

The set value of the interval parameter is as follows:

Set Description YYYY Year Q season M month Y Year day number D day W One week's day WW week h N minutes s second

The setting value of the firstdayofweek parameter is as follows:

The constant value describes VbuseSystem0 Use the NLS API settings. VBSunday1 Sunday (Default) VBMonday2 Monday VBTESDAY3 Tuesday Vbwednesday4 Wednesday VBThursday 5 Thursday Vbfriday6 Friday VBSATURDAY7 Saturday

The constant value describes VbuseSystem0 with NLS API settings. VBFirstjan11 from the week of the week (default). VbfirstfourDays2 starts from the first one of the first half of the year. VBFirstfulWeek3 starts from the first day of the year.

Description

The dateDiff function can be used to determine the number of time intervals specified between the two dates. For example, you can use dateDiff to calculate how many days between the two dates, or how many weeks have been calculated from today.

In order to calculate the number of days of Date1 and Date2, "annual days" (Y) or "Japanese" (D) can be used. When Interval is "a week" (W), DateDiff returns the number of weeks during the two days. If DATE1 is Monday, DateDiff calculates the number of days of Date2. This number contains DATE2 but does not contain date1. However, if Interval is "week" (WW), the dateDiff function returns the number of "calendar weeks" during the two days. It is obtained from the number of Sundays between Date1 and Date2. If DATE2 is just on Sunday, Date2 will also be added to the count result of Datediff; but whether Date1 is Sunday, it does not count it in.

If DATE1 is late than Date2, the return value of the dateDiff function is negative.

The firstdayofweek parameter affects the results of using time interval symbol "W" or "WW".

If DATE1 or DATE2 is a date text, the specified year is a fixed portion of the date. However, if Date1 or Date2 is enclosed in dual quotation marks (""), and the year is omitted, the current year is inserted into the code at each time calculation of the expression DATE1 or DATE2. This will be written in program code for different years.

Datediff returns 1 to 1 year of different years, although it is actually just a year of different years.

DatePart function

Returns a Variant (Integer) that contains a specified time part of known date.

grammar

DatePart (Interval, Date [, Firstdayofweek [, Firstweekofyear]])

There is the following naming parameters in the datepart function syntax:

Some describe the interse necessary. String expressions are the time interval to return. Date is necessary. The Variant (Date) value to be calculated. Firstdayofweek is optional. Specifies the constant of the first day of a week. If you do not designate, the Sunday is the first day. Firstweekofyear is optional. Specifies the constant of the first week of the year. If not specified, the week is the first week of the week of January 1. Set

The set value of the interval parameter is as follows:

Set Description YYYY Year Q season M month Y Year day number D day W One week's day WW week h N minutes s second

The setting value of the firstdayofweek parameter is as follows:

The constant value describes VbuseSystem0 Use the NLS API settings. VBSunday1 Sunday (Default) VBMonday2 Monday VBTESDAY3 Tuesday Vbwednesday4 Wednesday VBThursday 5 Thursday Vbfriday6 Friday VBSATURDAY7 Saturday

The setting value of the firstweekofyear parameter is as follows:

The constant value describes VbuseSystem0 Use the NLS API settings. VBFirstjan11 from the week of the week (default). VbfirstfourDays2 starts from the first one of the first half of the year. VBFirstfulWeek3 starts from the first day of the year.

Description

The DatePart function can be used to calculate the date and return to the specified time interval. For example, you can use DatePart to calculate a certain date is a day or now for a few o'clock.

The firstdayofweek parameter affects the results of using time interval symbol "W" or "WW".

If DATE is a date text, the specified year is a fixed portion of the date. However, if Date is enclosed in dual quotation marks (""), and the year is slightly not mentioned, the current year is inserted into the code at each time calculated DATE expression. This will be written in program code for different years.

DateSerial function

Returns Variant (Date) containing the designated year, month, day.

grammar

Dateserial (Year, Month, Day)

DateSerial function syntax has the following name parameters:

Partially describes Year necessary; integer. Integers from 100 to 9999, or a numerical expression. Month is necessary; integer. Any numerical expression. Day necessary; integer. Any numerical expression.

Description

In order to specify a date, such as December 31, 1991, the value range of each parameter in the DateSerial function should be acceptable; that is, the value of the daily value should be between 1-31, but the month The value range should be between 1-12. However, when a numerical expression represents the previous day, month, month, month, and the number of parameters that use this value expression can be specified for each parameter using this numerical expression.

A numerical expression is used instead of an absolute date in the following example. Here, the DateSerial function returns the decade (1990 - 10) for ten years (1990 - 10) for another day (8 - 2) for another day (1 - 1); in other words, it is May 31, 1980 .

Dateserial (1990 - 10, 8 - 2, 1 - 1)

If the numerical value of the year parameter is between 0 and 29, it is explained to 2000-2029, and if it is between 30 and 99, it is explained in 1930-1999. For all other Year parameters, use four digits (such as 1800).

When the value of any of the parameters is exceeded, it will carry out the next larger time unit in a timely manner. For example, if you specify 35 days, the number of days is explained to more than a month, and the number of days will be determined by its year. If a parameter value exceeds -32, 768 to 32, 767, it will cause errors. DateValue function

Returns a Variant (date).

grammar

DateValue (date)

The necessary DATE parameter DATE is usually a string expression that represents a date between January 1 to December 31, 9999. However, DATE can also be any expression, the date represented, the time is within the above range.

Description

If DATE is a string and its content is only a digital and a date separator separated by the number, DateValue will identify the month, day, annual order according to the short date format specified in the system. DateValue also recognizes the clear English-month name, full name or abbreviation. For example, in addition to 12/30/1991 and 12/30/91, DateValue also recognizes December 30, 1991 and DEC 30, 1991.

If Date is slightly went to this part, DateValue will use the current year set by the computer system date.

DateValue will not return it if the Date parameter contains time information. However, if Date contains invalid time information (such as 89:98), it will cause errors.

Day function

Returns a Variant (Integer), its value is an integer between 1 and 31, indicating a certain day in a month.

grammar

Day (date)

The necessary DATE parameters can be any variant, numerical expressions, string expressions, or their combinations that can represent the date. Returns NULL if Date contains NULL.

DDB function

Returns a Double, specifying a depreciation of an asset within a specific period. Calculations can be calculated using a dual drop-to-balance method or other specified method.

grammar

DDB (COST, SALVAGE, Life, Period [, Factor])

The DDB function has the following naming parameters:

Part of the description of Cost is necessary. Double specifies the initial cost of the asset. SALVAGE is necessary. Double. Specifies the value of assets at the end of the use period. Life is necessary. Double specifies the available age available for assets. PERIOD is necessary. Double Specifies the time used in calculating the asset depreciation. Factor is optional. Variant specifies the speed at which the balance is lowered. If omitted, 2 (double drop-off method) is the default value.

Description

Double drop-down recovery balance method calculates depreciation with accelerated interest rate method. In the first period, the depreciation is the highest, and the decrease in the next period.

The Life and Period parameters must be represented by the same unit. For example, if the LIFE is represented by the month, PERIOD must also be represented by the month. All parameters must be a positive value.

DDB functions use the following formula to calculate depreciation after a certain period of time:

Depreciation / period = ((Cost - Alvage) * Factor / Life

DIR function

Returns a string to represent a file name, a directory name, or a folder name, which must match the specified mode or file properties, or disk volume.

grammar

Dir [(Pathname [, Attributes])]

The syntax of the DIR function has the following parts:

Partially describes the optional parameters of the Pathname. The string expressions used to specify the file name, which may contain directories or folders, and drives. If you do not find PathName, zero length string ("") will be returned. Attributes optional parameters. Constant or numerical expressions, their sums of files are used to specify file properties. If omitted, a file that matches PathName but does not contain attributes is returned. Settings

The set of Attributes parameters can be:

Constant Value Description VBNORMAL0 (Default) Specifies files that do not have attributes. vbreadonly1 Specifies the only-read-only file VBHIDDEN2 Specifies the hidden file VBSystem4 specified system file VBVolume8 specifying the system file vbvolume8 specifying the volume file; if other properties are specified, ignore the VBVoluMevBDirectory16 Specify the unacity file and its path and folder.

Note that these constants are specified by VBA, and these constants can be used to replace the true value in any position specified in the program code.

Description

DIR supports multi-character (*) and single-character (?) Wildcards to specify multiple files.

Since Macintosh does not support wildcards, use the file type to specify the file group. You can use the Macid function to specify the file type without the file name. For example, the following statements returns the name of the first Text file in the current folder:

Dir ("SomePath", Macid ("Text"))

To select all files in the folder, specify a space:

DIR ("")

In Microsoft Windows, errors will be generated if the Macid function is used in the DIR function.

Any Attribute value greater than 256 is considered to be the value of the Macid function.

When the DIR function is called for the first time, you must specify PathName, otherwise an error will occur. If the file attribute is also specified, it must include pathname.

DIR will return to the first file name that matches PathName. If you want other file names that match the PathName, then call DIR again, and do not use parameters. If there is no conditional file, DIR will return a zero-length string (""). Once the return value is zero length string, the PathName must be specified when the DIR is called again, otherwise an error will occur. You don't have to access all file names that match the current Pathname, you can change to a new PathName. However, the DIR function cannot be called in a recursive mode. Call the DIR in the VBDirectory property cannot be continuously returned.

Tip Since the file name does not return with a special order, the file name can be stored in an array and then sort this array.

DoEvents function

Transfer control to allow the operating system to handle other events.

grammar

Doevents ()

Description

The DoEvents function returns an Integer to represent the number of forms opened in the Visual Basic's standalone version, for example, Visual Basic, in other applications, doevents returns 0.

DoEvents will pass control to the operating system. When the operating system processes the events in the complex column, and after all the keys in the SendKeys queue are sent, the control is returned.

DoEvents For simplified processes such as allowing users to cancel a start-up process - such as searching for a file - especially useful. For long-term processes, abandon control is best to use timers or through delegated tasks to the ActiveX EXE part. In the future, the task is completely independent of the application, multitasking and time sheet by the operating system.

Note ensures that the process of the control is abandoned in DOEvents. Before the first doevents returns, the other part of the code cannot be called again; otherwise it will produce unpredictable results. In addition, if other applications may interact with this procedure, do not use DOEvents because the control is not discarded at this time. Environ function

Returns String, which is connected to an operating system environment variable. Not available in Macintosh.

grammar

Environ ({Envstring | Number})

The syntax of the Environ function contains these named parameters:

Partially describe the optional parameters of EnvString. Contains a string expression of an environment variable name. Number optional parameters. Value expressions are used to represent the numerical order in the environment string in the environmental string table. Number parameters can be arbitrary numerical expressions, but it will be converted to an integer before calculating.

Description

If EnvString cannot be found in the environmental string table, a zero length string ("") is returned. If found, Environment returns a piece of text. The text is assigned to the specified envstring, that is, the text behind the equity (=) of the environment variable in the environmental string table.

If Number is specified, the string on the corresponding position in the environmental string table will return. In this case, Environ will return the entire text, including EnvString. If there is no environment string on the specified location, Environ will return a zero length string.

EOF function

Returns an Integer, which contains the Boolean value true, indicating that the end of the file that has been reached to the Random or sequence INPUT.

grammar

Eof (Filenumber)

The necessary FILENUMBER parameters are an Integer that contains any valid file numbers.

Description

Using EOF is to avoid errors caused by inputting at the end of the file.

Until the end of the file, the EOF function returns false. For files opened for accessing random or binary, the EOF returns false when the last-executed GET statement cannot read out of the full record.

For files opened for accessing binary, trying to read the entire file before the EOF function returns TRUE, any attempt to read the entire file will result in an error. When reading binary with the INPUT function, use the LOF and LOC functions to replace the EOF function, or use the GET function to work with the EOF function. For files opened for Output, EOF always returns TRUE.

Error function

Returns an error message corresponding to the known error number.

grammar

Error [(ERRORNUMBER)]

This optional ErrorNumber parameter can be any valid error number. If ErrorNumber is a valid error number, but has not been defined, ERROR will return a string "application-defined error or object definition error". If ErrorNumber is not a valid error number, it will cause errors. If ErrorNumber is omitted, the message corresponding to the most recent runtime error will be returned. If there is no runtime error, or ErrorNumber is 0, ERROR returns a string ("") of length zero.

Description

Please check the properties settings of the ERR object to determine whether the last runtime error. The return value of the ERROR function corresponds to the Description attribute of the ERR object.

EXP function

Returns Double, specifying a part of the E (natural logarithmic bottom). grammar

Exp (Number)

The necessary NUMBER parameter Number is a double or any valid numerical expression.

Description

If the value of Number exceeds 709.782712893, the error will occur. The value of constant E is approximately 2.718282.

Note that the role of the EXP function is complementary, so it is sometimes referred to as opposition.

FileAttr function

Returns a long, indicating the file mode of using the file opened by the Open statement.

grammar

FileAttr (Filenumber, Returntype)

The syntax of the FileAttr function has the following names:

Partial description filenumber is necessary. INTEGER type, any valid file number. Returntype is necessary. Integer type. It is a number and pointing to the type of return information. Specifies 1 to return a value of a representative file. Only in the 16-bit system, specify 2 to resume the file handle of the operating system. Returntype 2 is not supported in the 32-bit system, which will cause errors.

return value

When the returntype parameter value is 1, the following return value indicates the way the file is accessible:

Mode Value Input1output2random4append8binary32

FileDateTime function

Returns a variant (date), which is created or last modified date and time after a file.

grammar

FileDatetime (Pathname)

The necessary pathname parameters are string expressions used to specify a file name. PathName can contain directories or folders, and drives.

Filelen function

Returns a long, representing the length of a file, the unit is byte.

grammar

Filelen (Pathname)

The necessary pathname parameters are string expressions used to specify a file name. PathName can contain directories or folders, and drives.

Description

When the Filelen function is called, if the specified file has been opened, the returned value is the size of this file before opening.

Note To obtain a length size of an open file, use the LOF function.

Filter function

description

Returns a subscript from zero starting array, which contains a subset of a string array based on a specified filter condition.

grammar

FILTER (InputStrings, Value [, include [, compare]])

The Filter function syntax has the following sections:

Partially describes InputStrings necessary. To perform a one-dimensional string array of search. Value is required. String to search. INCLUDE is optional. The Boolean value indicates that the return substring contains or does not contain a Value string. If INCLUDE is TRUE, Filter returns an array subset that contains the Value sub-string. If INCLUDE is false, Filter returns an array subset that does not contain a Value sub-string. Compare is optional. Digital values ​​indicate the string comparison type used. For its settings, see the "Settings Value" section below.

Settings

The set value of the Compare parameter is as follows:

Constant value describes VBuseCompareOption-1 to perform comparisons using the option value of the Option Compare statement. VbinaryCompare 0 performs binary comparison. VbtextCompare 1 performs text comparison. VBDatabaseCompare 2 is only used for Microsoft Access. Perform a comparison based on your database information.

Description

If no value matched with the value in InputStrings, Filter returns an empty array. If INPUTSTRINGS is NULL or not a one-dimensional array, an error is generated.

An array returned by the FILTER function, the number of elements is just the number of matching items found. Format function

Returns Variant (String), which contains an expression that is formatted according to the instructions in the format expression.

grammar

Format (Expression [, Format [, Firstdayofweek [, Firstweekofyear]])

The syntax of the Format function has the following sections:

Some explain the necessary parameters of Expression. Any effective expression. Format optional parameters. Effective naming expressions or user-defined format expressions. Firstdayofweek optional parameters. Constant, means a week's first day. Firstweekofyear optional parameters. Constant, representing the first week of one year.

Settings

The firstdayofweek parameter has the following settings:

Constant value description VbuseSystem0 uses NLS API settings. Vbsunday1 Sunday (default) VBMonday2 Monday VBTESDAY3 Tuesday VBwednesday Wednesday VBTHURSDAY5 Thursday Vbfriday6 Friday VBSATURDAY7 Saturday

The firstweekofyear parameter has the following settings:

Constant value description VbuseSystem0 uses NLS API settings. Vbfirstjan11 begins with the week containing January 1 (default). VBFirstFourDays2 starts from the first week of this year, and this week is at least four days in this year. VBFirstfulWeek3 starts the first week of this year, while this week is completely in this year.

Description

Formatting practices use pre-defined naming value formats or create user-defined numeric formats. Date and time use pre-defined named date / time format or create user-defined date / time format. Date and time series use date and time format or numerical format. String creates a custom string format.

If FORMAT is not specified when formatting numbers, Format will provide a function similar to the STR function, although it is international. However, with the format does not retain the positive and negative space on the positive number, and if the Str is, will be.

Formatcurrency function

description

Returns an expression of a currency format that uses the currency symbol defined in the system control panel.

grammar

Formatcurrency (Expression [, NumdigitsafterDecimal [, includeEleadingdigit [, useparensfornegativeNumbers [, groupdigits]]]])

The Formatcurrency function syntax has the following sections:

Partially describes Expression necessary. To format the expression. NumdigitsAfterDecimal is optional. The digital value indicates the number of display bits on the right side of the decimal point. The default is -1, indicating the area setting value of the computer. INCLUDELEADIGIT is optional. The tri-state constant indicates whether a zero is displayed before the decimal point. For its value, see the "Settings Value" section. UseparensfornegativeNumbers is optional. Three-state constants, indicating whether the negative value is placed in a bracket. For its value, see the "Settings Value" section. GroupDigits is optional. Three-state constants, indicating whether the numbers are packet with the group separator, and the component jaw is specified by the area setting value of the computer. For its value, see the "Settings Value" section.

Settings

IncludeEadingDigit, the setting value of the UseParensfornegativeNumbers and GroupDigits parameters is as follows:

Constant Value Description TristateTrue-1 TruetristateFalse0FalSetriStateUsesedefault-2 uses the settings in the computer area settings.

Description

When one or more option parameters are ignored, the ignored parameter value is provided by the area setting value of the computer.

The location of the currency symbol relative to the currency value is determined by the area of ​​the computer.

Note that all set value information comes from the "Regional" tab, and the start zero is from the "Number" tab.

FormatDateTime function

description

Returns a date or time format expression.

grammar

Formator (Date [, namedFormat])

The formatdatetime function syntax has the following sections:

Partially describes DATEs. The date expression to be formatted. NamedFormat is optional. Digital values, indicate the format used by date / time. If you ignore this value, use VBGeneralDate.

Settings

The setting value of the NamedFormat parameter is as follows:

Constant value describes VBGeneLDate0 displays date and / or time. If there is a date part, display it in a short date format. If there is a time part, it is displayed in a long time format. If you have, both parts are displayed. VBlongDate1 displays the date with the long-term format specified in the computer area setting value. VBShortDate2 displays the date with the short date format specified in the computer area setting value. VBlongTime3 displays time in the time format specified in the computer area setting value. VBShortTime4 displays time with 24-hour format (HH: mm).

FormatNumber function

description

Returns an expression of a digital format.

grammar

FormatNumber (Expression [, NumdigitsAfterDecimal [, includeEleadingdigit [, useparensfornegativenumbers [, groupdigits]]]])

The FormatNumber function syntax has the following sections:

Partially describes Expression necessary. To be formatted expression. NumdigitsAfterDecimal is optional. The digital value indicates the number of display bits on the right side of the decimal point. The default is -1, indicating the area setting value of the computer. INCLUDELEADIGIT is optional. The tri-state constant indicates whether zero is displayed before the decimal point. For its value, see the "Settings Value" section. UseparensfornegativeNumbers is optional. The tri-state constant indicates whether the negative value is placed in parentheses. For its value, see the "Settings Value" section. GroupDigits is optional. The three-state constant indicates whether the digital packet is used by the set divider, and the component segments are specified in the area setting value of the computer. For its value, see the "Settings Value" section.

Settings

IncludeEadingDigit, the setting value of the UseParensfornegativeNumbers and GroupDigits parameters is as follows:

The constant value describes the setting value in the TristateTrue-1TrueTristateFalse0FalSetristateUsesedefault-2 in the computer area setting value.

Description

When one or more option parameters are ignored, the ignored parameter value is provided by the area setting value of the computer.

Note that all set value information comes from the "Digital" tab of "Area Settings".

Formatpercent function

description

Returns a percentage format (multiplying 100) expression, with% symbols.

grammar

Formatpercent (Expression [, NumdigitsAfterDecimal [, includeEleadingdigit [, useparensfornegativenumbers [, groupdigits]]]])

The Formatpercent function syntax has the following sections:

Partially describes Expression necessary. To format the expression. NumdigitsAfterDecimal is optional. Indicates the number of display bits on the right side of the decimal point. The default is -1, indicating the area setting value of the computer. INCLUDELEADIGIT is optional. The tri-state constant indicates whether zero is displayed before the decimal point. For its value, see the "Settings Value" section. UseparensfornegativeNumbers is optional. Three-state constants indicating whether negative numbers are placed in parentheses. For its value, see the "Settings Value" section. GroupDigits is optional. The tri-state constant indicates whether the number is packet with the group separator, and the component segments are specified in the area setting value of the computer. For its value, see the "Settings Value" section. Settings

IncludeEadingDigit, the setting value of the UseParensfornegativeNumbers and GroupDigits parameters is as follows:

Constant Value Description TristateTrue-1 TrueTristateFalse0FalSetristateUsesedefault-2 uses the settings in the computer area setting value.

Description

When one or more option parameters are ignored, the ignored parameter value is provided by the area setting value of the computer.

Note that all set value information comes from the "Digital" tab of "Area Settings".

FreeFile function

Returns an Integer that represents the next file number that is available for the Open statement.

grammar

Freefile [(Rangenumber)]

Optional parameter RanGenumber is a Variant, which specifies a range to return the next available file number within the range. Specify 0 (default) Returns a file number between 1-255. Specify 1 returns a file number between 256 - 511.

Description

Provide a file number that has not been used with FreeFile.

FV function

Returns a Double, specifying the future periodic quota payment and a fixed annuity.

grammar

FV (Rate, NPER, PMT [, PV [, Type]])

The FV function has the following named parameters:

Partially describes the necessary. Double, specify the interest rate of each period. For example, if there is a loan annual percentage (APR) to be 100% and monthly car loans, the interest rate is 0.1 / 12 or 0.0083. NPER is necessary. Integer, specifying a total payment period of a payment. For example, if you choose a four-year car loan to pay by monthly payment, the loan period has a total of 4 * 12 (or 48) payments. PMT is necessary. Double Specifies the payment amount for each period. The payment amount usually contains the principal and interest, and this payment amount will not change during the validity of the annuity. PV is optional. Variant, specifies the present value of the future of a series of payments (or a payment). For example, when borrowing money to buy a car, the amount borrowed to the credit is the present value of the next monthly payment to the loan. If omitted, the default is 0. TYPE is optional. VARIANT, specifying the loan expiration time. If the loan expires at the end of the loan cycle, use 0. If the loan expires during the cycle, use 1. If omitted, the default is 0.

Description

The annuity is a series of fixed cash payments for a while. The annuity can be a loan (such as a house mortgage) or a investment (such as a monthly savings plan).

During the payment, the same unit must be calculated using the same unit to calculate the Rate and NPER parameters. For example, if Rate is calculated in the month, NPER must also be calculated in the month.

For all parameters, with negative numbers (such as savings deposits), with positive numbers, cash income (such as bonus check).

The getallSettings function returns all registry items for the application project from the Windows Registry (starting from Savesetting).

grammar

GetallSettings (AppName, Section)

The syntax of the getallSettings function has the following naming parameters:

Partial description

Appname is necessary. String expressions, contain names or project names, and require these applications or projects to have registry entries

Section is necessary. String expressions, including the area name, and require that the area has a registry key setting. GetallSettings returns Variant, which is a two-dimensional array of strings, which contains all registry entries settings and their corresponding values ​​in the specified area.

Description

If the appName or Section does not exist, getallSettings returns a Variant that is not initialized.

Getattr function

Returns an Integer, this is an attribute of a file, directory, or folder.

grammar

Getattr (Pathname)

The necessary pathname parameters are string expressions used to specify a file name. PathName can contain directories or folders, and drives.

return value

The value returned by GetAttr is the sum of these attribute values:

Constant Value Description VBNORMAL0 General VBReadonly1 Read-only VBHIDEN2 Hide VBSystem4 System File VBDirectory16 Directory or Folder VBarchive32 After the last backup, the file has changed the file name specified by Vbalias64 is an alias.

Note that these constants are specified by VBA, and these constants can be used to replace the true value in any position specified by VBA.

Description

To determine if an attribute is set, the AND operator is used between the GetAttr function and the attribute value you want to know. If the resulting result is not zero, then this property value is set. For example, in the AND expression, if the file (Archive property is not set, the return value is zero:

Result = Getattr (FNAME) and vBarchive

Returns a non-zero value if the file properties of the file are set.

GetObject function

Returns a reference to the ActiveX object in the file.

grammar

GetObject ([Pathname] [, Class])

The syntax of the getObject function contains the following naming parameters:

Partially describes the PathName optional; Variant (String). The full path and name of the file that contains the object to be retrieved. If Pathname is omitted, the Class is required. Class is optional; Variant (String). Represents a string of the class of the object.

Among them, the syntax format of the Class parameter is appname.ObjectType, and the various parts of the grammar are as follows:

Partially describes AppName necessary; Variant (String). Provides the application name of the object. ObjectType must be required; Variant (String). Type or class to be created.

Description

Use the getObject function to access the ActiveX object in the file, and you can assign the object to the object variable. You can use the SET statement to assign the object returned by getObject to the object variable. E.g:

DIM CADOBJECT AS Object

Set Cadobject = GetObject ("c: /cad/schema.cad")

When performing the above code, the application associated with the specified PathName is initiated, and the objects in the specified file are activated.

If PathName is a zero length string (""), getObject returns a new object instance for the specified type. If the PathName parameter is omitted, getObject returns the object of the current activity of the specified type. If there is currently no object specified type, it will be wrong. Some applications allow only part of the file to be activated, and the method is to add an exclamation mark (!) And a string for identifying the file part you want to activate. For information on how to create this string, see the documentation about the application to create an object.

For example, in a drawing application, a plurality of layers stored in the file may have multiple layers. You can use the following code to activate the layers called schema.cad in the figure:

Set layerObject = getObject ("c: /cad/schema.cad! Layer3")

If you do not specify a Class of the object, automation will determine the started application and the activated object depending on the file name provided. However, some files may not only support an object class. For example, a picture may support three different types of objects: Application objects, Drawing objects, and Toolbar objects, all of which are part of the same file. To illustrate which object to be specifically activated, this optional Class parameter should be used. E.g:

DIM MyObject As Object

Set myObject = getObject ("c: /drawings/sample.drw", "figment.drawing")

In the above example, Figment is a name of a plot application, while Drawing is an object type it supports.

Once the object is activated, you can use the defined object variables in your code to reference it. In the previous example, the object variable myObject can be used to access the properties and methods of this new object. E.g:

MyObject.Line 9, 90

MyObject.inserttext 9, 100, "Hello, World."

MyObject.saveas "c: /drawings/sample.drw"

Note that the getObject function is used when the object is currently an instance or when an object to be created is created. If the object is currently not an instance, or if you do not want to launch an object of the loaded file, you should use the CreateObject function.

If the object is registered as an object of a single instance, you can only create an instance of the object regardless of how the CreateObject is performed. If you use a single instance object, getObject always returns the same instance when using a zero length string ("") syntax, and if the PathName parameter is omitted, it will be wrong. You cannot use GetObject to get a reference to the class created by Visual Basic.

GetSetting function

Returns the registry key setting value from the application item in the Windows Registry.

grammar

GetSetting (Appname, Section, Key [, Default])

The syntax of the GetSetting function has the following naming parameters:

Partial description

Appname is necessary. String expressions, including applications or project names, requiring these applications or projects with registry entries. Section is necessary. String expressions, containing the area name, requiring this area to have a registry key setting. Key is necessary. String expression, returns the name of the registry key setting. Default is optional. Expression, if there is no setting in the registry key setting, returns the default value. If omitted, the default is a string ("") having a length zero length. Description

If any of the parameters of GetSetting does not exist, getSetting returns the value of default.

HEX function

Returns String on behalf of hexadecimal value.

grammar

HEX (Number)

The necessary Number parameters are any valid numerical expressions or string expressions.

Description

If Number is not an integer, then it will be rounded into the closest integer before execution.

If Number is NullnulleMpty zero (0) any other number of numbers can be up to eight hexadecimal characters.

Numbers within an appropriate range, prefixed with & h, can directly represent hexadecimal numbers. For example, the hexadecimal representation of & H10 represents a decimal 16.

Hour function

Returns a Variant (Integer), its value of 0 to 23, indicating a certain hour in the day.

grammar

Hour (Time)

The necessary Time parameters can be any variant, numerical expressions, string expressions, or a combination thereof that can be expressed. Returns NULL if the time contains NULL.

Returns a Variant (Integer), its value of 0 to 23, indicating a certain hour in the day.

grammar

Hour (Time)

The necessary Time parameters can be any variant, numerical expressions, string expressions, or a combination thereof that can be expressed. Returns NULL if the time contains NULL.

IIF function

Depending on the value of the expression, it returns one of the two parts.

grammar

IIF (Expr, TruePart, Falsepart)

The syntax of the IIF function contains the following name parameters:

Some describe the EXPR necessary parameters. It is used to judge the expression of the authenticity. TruePart necessary parameters. Returns the value or expression of this section if the expr is true. FalsePart necessary parameters. If the expr is false, the value or expression of this section is returned.

Description

Since IIF calculates TruePart and FalsePart, although it only returns one of them. Therefore, you should pay attention to this side effect. For example, if FalsePart generates a zero error, the program will have an error, even if the expr is true.

IMestatus function

Returns an Integer to specify the current Microsoft Windows input method (IME) method; only valid for the East Asian area version.

grammar

Imestatus

return value

Below is the return value of Japan countries:

Does not control constants described vbIMEModeNoControl0 IME (default) vbIMEModeOn1 open IMEvbIMEModeOff2 off IMEvbIMEModeDisable3IME invalid vbIMEModeHiragana4 Hiragana mode to full width katakana mode vbIMEModeKatakana5 full width Katakana vbIMEModeKatakanaHalf the full width of half width Katakana Alphanumeric mode mode6 mode vbIMEModeAlphaFull mode7 vbIMEModeAlpha mode8 Alphanumeric Mode The following is a half width of Korea Regional return value:

Constant Value Description VbimeModealphafull7 Complete Width Alphaumeric Mode VbimeModealpha8 Halft Wide Alphaumeric Mode VbimeModeHangulfull9 Complete Width HANGUL Mode VbimeModeHangul10 Half Wide HANGUL Mode

Below is the return value in the Chinese area:

Constant value description VbimeModenoControl0 does not control IME (default) VbimeModeon1 Open IMEVBIMEMODEOFF2 Turn IME

INPUT function

Returns String, which contains characters in the file opened in Input or Binary.

grammar

INPUT (Number, [#] filenumber)

The syntax of the Input function has the following parts:

Partially describes Number necessary. Any valid numerical expression specifies the number of characters to return. Filenumber is necessary. Any valid file number.

Description

The data written to the INPUT function is usually written to the file. The Input function is only used to open files in Input or Binary.

Unlike the input # statement, the input function returns all characters it read, including commas, carriage returns, gap columns, wrap, quotation marks, and preambles.

For the Binary Access Type, if you try to read the entire file with the Input function, an error is generated when EOF returns True. When reading binary with Input, use the LOF and LOC functions instead of the EOF function, and when using the EOF function, you should work with the GET function.

Note that the INPUTB function is to be used for the byte data contained in the text file. For INPUTB, Number specifies the number of bytes to return, not the number of characters to be returned.

Inputbox function

In a dialog box, the prompt is displayed, waiting for the user to enter the text or press the button and return the String containing the contents of the text box.

grammar

InputBox (Prompt [, Title] [, Default] [, XPOS] [, YPOS] [, HelpFile, Context])

The syntax of the inputbox function has the following name parameters:

Partially describes PROMPTs necessary. String expressions appearing as a dialog message. The maximum length of the PROMPT is approximately 1024 characters, which is determined by the width of the characters used. If the PROMPT contains multiple rows, it can be used to use the backhand between the rows (CHR (13)), a wrap (CHR (10)) or the carriage return (CHR (13) & chr (10)) Separate. Title is optional. Display string expressions in the dialog title bar. If Title is omitted, put the application name in the title bar. Default is optional. Display the string expression in the text box, as the default value without other inputs. If DEFAUT is omitted, the text box is empty. XPOS is optional. Numerical expressions, pairs, the horizontal distance between the left side of the specified dialog and the left side of the screen. If XPOS is omitted, the dialog will be homoked in the horizontal direction. YPOS is optional. Numerical expression, pair, the desired dialog, the distance on the screen. If YPOS is omitted, the dialog is placed approximately one-third of the position below the vertical direction of the screen. Helpfile is optional. String Expressions, Identify Help Files, with this file to provide context-related help with this file. If HelpFile is provided, Context must also be provided. Context is optional. Numerical expressions, the author of the help file is specified to a help context number for a help topic. If context is provided, heLpFile must also be provided. Description

If the HelpFile and Context are provided, the user can press F1 to view the help topic corresponding to the Context. Some primary applications, for example, Microsoft Excel, will automatically add a Help button in the dialog. If the user clicks OK or presses Enter, the inputbox function returns the content in the text box. If the user clicks Cancel, this function returns a string ("") of length zero.

Note If you want to specify parameters other than the first named parameter, you must use InputBox in your expression. If you want to omit some location parameters, you must join the corresponding comma delimiter.

INSTR function

Returns Variant (long), specifying a string in the first position in another string.

grammar

INSTR ([Start,] string1, string2 [, compare])

The syntax of the INSTR function has the following parameters:

Some describe the optional parameters of the start. To set the starting point for each search. If omitted, start from the position of the first character. If start contains NULL, an error will occur. If the Compare parameter is specified, there must be a start parameter. String1 necessary parameters. Accept the search for string expressions. String2 necessary parameters. String character string expression. COMPARE Optional parameters. Specifies a string comparison. If Compare is NULL, an error will occur. If compare, the setting of the Option Compare will determine the type of comparison.

Set

The COMPARE parameter is set to:

Constant Value Description VBuseCompareOption-1 Executes a comparison with the OPTION COMPARE statement. VbbonaryCompare0 performs a binary comparison. VbtextCompare1 performs a comparison of the original text. VBDatabaseCompare2 applies only to Microsoft Access, performing a comparison based on information in a database.

return value

If INSTR returns String1 to zero length 0String1 to nullnullstring2 for zero length StartString2 to find 0 in string1 Find the position of String2 START> String20

Description

The INSTRB function acts on byte data contained in the string. So INSTRB returns the byte position instead of the character position. INSTRREV function

description

Returns a string that appears in another string, counts from the end of the string.

grammar

Instrrev (String1, String2 [, Start [, Compare]])

The Instrrev function syntax has the following sections:

Partially describes String1. To perform a string expression of the search. String2 must be required. String expressions to search for. START is optional. Value expression, set the beginning of each search. If ignored, use -1, which indicates starting from the previous character position. If start contains NULL, an error is generated. Compare is optional. The numeric value indicates the comparative method used when it is determined by the sub-string. If ignored, a binary comparison is performed. For its value, see the "Settings Value" section.

Settings

The compare parameter value is as follows:

The constant value describes the VBuseCompareOption-1 to perform comparisons with the set value of the Option Compare statement. VbinaryCompare 0 performs binary comparison. VbtextCompare 1 performs text comparison. VBDatabaseCompare 2 is only used for Microsoft Access. Performance based on your database information.

return value

The INSTRREV returns are as follows:

If the Instrrev returns a String1 length is zero. 0String1 is NULL. NullString2 length is not found for nullnullstring2 for zero startstring2. 0String2 is found in String1. Find the location of the matching string. Start> len (string2) 0

Description

Note that the syntax of the INSTRREV function is different from the syntax of the Instr function.

INT, FIX function

Returns the integer part of the parameter.

grammar

Int (Number)

FIX (Number)

The necessary Number parameters are Double or any valid numerical expression. Returns NULL if Number contains NULL.

Description

INT and FIX will delete the decimal part of the Number and return the remaining integers.

The difference between INT and FIX is that if Number is a negative number, INT returns the first negative integer smaller than or equal to Number, and FIX returns a first negative integer greater than or equal to Number. For example, INT converts -8.4 into -9, while FIX converts -8.4 into -8.

FIX (Number)

SGN (NUMBER) * INT (ABS (Number))

IPMT function

Returns a Double that specifies the interest value paid for an annuity for a periodic payment and interest rate fixed within a period of time.

grammar

IPMT (Rate, Per, NPER, PV [, FV [, Type]])

The IPMT function has the following naming parameters:

Partially describes the necessary. Double specifies the interest rate of each period. For example, if there is a loan annual percentage (APR) to be 100% and monthly car loans, the interest rate per period is 0.1 / 12, or 0.0083. PER is necessary. Double specifies the payment cycle in NPER room. NPER is necessary. Double specifies a total of payment of payments. For example, if you choose a monthly payment method in a four-year car loan, the loan has a total of 4 * 12 (or 48) payments. PV is necessary. Double, specify the present value of the future of a series of payments or receipts. For example, when borrowing money to buy a car, the amount of the credit will pay for the future monthly payment to the discipline. FV is optional. Variant specifies the future value or cash of the desired in the loan. For example, the future value of the loan is $ 0 after the loan is paid. However, if you want to save $ 50,000 as a child education fund in 18 years, $ 50,000 is the future value. If omitted, the default is 0. TYPE is optional. Variant specifies the loan expiration time. If the loan expires at the end of the loan cycle, use 0. If the loan expires during the cycle, use 1. If omitted, the default is 0. Description

Annuity refers to a series of fixed cash payments over a period of time. The annuity can be a loan (such as a house mortgage) or a investment (such as a monthly savings plan).

Rate and NPER parameters must be calculated using the same unit during payment. For example, if Rate calculates the month, NPER must also calculate the month.

For all parameters, with negative numbers (such as savings deposits), with positive numbers, cash income (such as bonus check).

IRR function

Returns a Double, specifying the internal interest rate of a series of periodic cash flow (expenditures or income).

grammar

Irr (Values ​​() [, Gues])

The IRR function has the following naming parameters:

Partially describes values ​​() necessary. Double array, specify cash flow value. This array must contain at least one negative value (payment) and a positive value (income). Guess is optional. Variant, specify the estimation value returned by IRR. If omitted, GUESS is 0.1 (10%).

Description

The returned internal interest rate is within the normal time interval, a interest rate obtained by investment in spending and income.

The IRR function uses the order in which the values ​​in the array interprets the order of payments and income. Ensure that the order of payments and revenue is correct. The cash flow in each period does not have to be fixed like an annuity.

IRR is calculated using the superfarable. Start with the value of Gues, the IRR repeated loop is calculated until the accuracy reaches 0.00001%. If the results cannot be obtained by 20 repeated superfine tests, the IRR calculation failed.

Isarray function

Returns the Boolean value indicating whether the variable is an array.

grammar

Isarray (varName)

The necessary VarName parameters are identifiers for a specified variable.

Description

If the variable is an array, isarray returns true; otherwise returns false. IsarRay is particularly useful for Variant expressions that contain arrays.

Isdate function

Returns the Boolean value indicating whether an expression can be converted to a date.

grammar

Isdate (Expression)

The necessary Expression parameters are a Variant, including a date express or string expression, the string expression here can be determined as a date or time.

Description

If the expression is a date, or can be identified as a valid date, isDate returns true; otherwise returns false. In Microsoft Windows, the effective date ranges from January 1, 2009 and between 31 December 1999; its effective range is different from the operating system. ISempty function

Returns the Boolean value, indicating whether the variable has been initialized.

grammar

ISempty (Expression)

The necessary Expression parameters are a variant, including a numerical or string expression. However, because ISemPTY is used to determine if the individual variables have been initialized, the Expression parameter is usually a single variable name.

Note If the variable is not initialized or explicitly set to EMPTY,

ISEMPTY

True; otherwise returned

False. in case

EXPRESSION contains multiple variables, then

ISempty always returns

False.

ISempty only returns information that makes sense to Variant expressions.

ISError function

Returns the Boolean value indicating whether the expression is an error value.

grammar

ISerror (Expression)

The necessary Expression parameters can be any valid expression.

Description

The error value is created using the CVERR function to convert the real number into an error value. The ISERROR function is used to determine if a numerical expression represents an error. If the Expression parameter represents an error, ISERROR returns true; otherwise returns false.

ISMissing function

Returns the Boolean value indicating whether an optional Variant parameter has been passed to the process.

grammar

Ismissing (argname)

The necessary argname parameters contain an optional Variant process parameter name.

Description

Use the ismissing function to detect whether you provide an optional Variant parameter when calling a program. If there is no pass value for a particular parameter, ismissing returns true; otherwise returns false. If ISMissing returns True to a parameter, use this lost parameter in other code will generate a user-defined error. If you use ismissing for the Paramarray parameter, the function always returns false. In order to detect empty Paramarray, try to see if the upper bound of the array is less than the lower bound.

Note that ISMissing doesn't work for simple data types (such as Integer or Double) because it is different from Variants, which does not have the "Loss" flag premise. For this, the default value can be specified for the optional parameter type. If the process is called, the parameter is ignored, the parameter will have the default, as shown in the following example:

Sub mysub (optional myvar as string = "specialvalue")

Ifvar = "SpecialValue" THEN

'Myvar is ignored.

Else

...

End Sub

In many cases, if the user is ignored from the function call, you can completely ignore the IF MYVAR test by making the default value equal to the value you want MYVAR. This will make your code more concise.

ISNULL function

Returns the Boolean value indicating whether the expression does not contain any valid data (NULL).

grammar

Isnull (Expression)

The necessary Expression parameters are a variant, which contains numerical expressions or string expressions.

Description

If Expression is NULL, isnull returns true; otherwise ISNULL returns false. If Expression consists of multiple variables, any NULL of the expression constituting components as a variable will return the entire expression. NULL value indicates that Variant does not contain valid data. NULL is different from EMPTY, which indicates that the variable has not been initialized. NULL and zero string ("") are also different, and the string of length zero is a null string.

Important Use the isnull function is to determine if the expression contains NULL values. In some cases, it is desirable that the expression is TRUE, such as IF VAR = NULL and IF VAR <> NULL value True, and their total value is false. This is because any expression containing NULL itself is NULL, so for false.

ISNUMERIC function

Returns the Boolean value, indicating whether the calculation result of the expression is the number.

grammar

IsNumeric (Expression)

The necessary Expression parameters are a Variant, which contains numeric expressions or string expressions.

Description

If the entire EXPRESSION operation result is a number, ISNUMERIC returns true; otherwise returns false.

If Expression is a date expression, ISNUMERIC returns false.

IsObject function

Returns the Boolean value indicating whether the identifier represents an object variable.

grammar

IsObject (Identifier)

The necessary Identifier parameters are a variable name.

Description

IsObject is only used to determine if Variant belongs to Vartype Vbobject. This may happen if the Variant actually references (or it has been cited).

If Identifier is an Object type or any valid class type, or if Identifier is a VARIANT or user-defined object of VARTYPE VBOBJECT, isobject returns true; otherwise returns false. Even if the variable is set to Nothing, ISOBJECT still returns True.

Use the error capture method to confirm whether the object reference is valid.

Join function

description

Returns a string that is created by connecting multiple sub-strings in a group.

grammar

Join (List [, Delimiter])

The Join function syntax has the following sections:

Partially describes the list. Contains a one-dimensional array of connector strings. Delimiter is optional. The character used to divide the subrid string in the string. If the item is ignored, the spacer ("") is used to partition strings. If Delimiter is a zero length string ("), all items in the list are connected together, and there is no separator in the middle.

LBound function

Returns a long-type data whose value is the minimum subscript for the specified array dimension.

grammar

LBound (ArrayName [, Dimension])

The grammar of the lbound function contains the following sections:

Partially describes ArrayName necessary. The name of the array variable follows the standard variable naming convention. Dimension optional; Variant (long). Specifies which one of the lower bounds returns. 1 Represents the first dimension, 2 means a second dimension, and so on. If Dimension is omitted, it is considered to be 1.

Description

The LBound function is used with the Ubound function to determine the size of an array. Ubound is used to determine the upper bound of a certain dimension of the array. For arrays with the following dimensions, the return value of LBound is shown in the table below:

DIM A (1 to 100, 0 to 3, -3 to 4)

Statement Return Value LBound (A, 1) 1LBound (A, 2) 0lbound (A, 3) -3

All default lower bounds of all dimensions are 0 or 1, depending on the setting of the Option Base statement. The lower bound of the array created using the Array function is 0; it is not affected by Option Base.

For arrays, private, public, redim, or static statements can be used as a lower bound.

LCase function

Returns the string of lowercase.

grammar

LCASE (String)

The necessary String parameters can be any valid string expression. If string contains NULL, NULL will be returned.

Description

Only uppercase letters will turn to lowercase; all lowercase letters and non-alphanumeric characters remain unchanged.

LEFT function

Returns Variant (String), which contains a specified number of characters from the left from the left.

grammar

LEFT (String, Length)

The syntax of the LEFT function has the following name parameters:

Part of the String necessary parameters. String Expressions The leftmost characters will be returned. If string contains NULL, NULL will be returned. Length necessary parameters; for Variant (long). Numerical expressions indicate how many characters will be returned. If 0, return zero length string (""). Returns the entire string if it is greater than or equal to String characters.

Description

I want to know the number of string, using the Len function.

Note that the LEFTB function acts on byte data contained in the string. So the length is specified by the number of bytes instead of the number of characters to be returned.

Len function

Returns Long, which contains the number of characters within the string, or the number of bytes required to store a variable.

grammar

Len (String | Varname)

The syntax of the LEN function has the following sections:

Some describe any valid string expressions for String. If string contains NULL, NULL will be returned. VarName Any valid variable name. If VarName contains NULL, NULL will be returned. If VarName is Variant, len will view its String and always returns the number of characters it contains.

Description

Two possible parameters must have one (and only one). If you define a type, Len returns its size to the file.

Note that the lenb function acts on byte data in a string, just as in a double-byte character set (DBCS) language. So the LENB returns the number of bytes used to represent the string, rather than returning the number of characters in the string. For the user-defined type, leNB returns the size of the memory, including the liner between the elements. For sample code to use leNB, see the second example in the example topic.

Note When you use a bell string in a user-defined data type, Len may not be able to determine the number of bytes required to actually store.

Loc function

Returns a long, specify the current read / write location in the open file.

grammar

LOC (Filenumber)

The necessary FileNumber parameters are any valid Integer file number.

Description

The return value of the LOC function to various file access methods is as follows:

Mode Return the record number that reads or writes on the file last time. The current byte position in the Sequential file divides the value of 128. However, for sequential files, the return value of the LOC is not used, and the return value of the LOC is also required. Binary reads or writes bytes on the top of the binary. LOF function

Returns a long, indicating the size of the file opened with the Open statement, which is in bytes.

grammar

Lof (Filenumber)

The necessary FileNumber parameters are an Integer that contains a valid file number.

Note For files that have not been opened, use the Filelen function to get its length.

Log function

Returns a Double, specifying the natural logar of the parameter.

grammar

Log (NUMBER)

The necessary NUMBER parameters are Double or any valid value of more than zero.

Description

The natural logarithm is the log in e a bottom. The value of constant E is approximately 2.718282.

As shown below, divide the natural logarithm value of X with N natural logarithm value, the log value of the value X can be calculated to any end n:

LOGN (X) = log (x) / log (n)

The following example shows how to write a function to see the log value of 10:

Static function log10 (x)

LOG10 = log (x) / log (10 #)

END FUNCTION

LTRIM, RTRIM and TRIM functions

Returns Variant (String), which contains a copy of the specified string, no preamble (LTRIM), trailing blank (RTRIM) or forward and tail blank (TRIM).

grammar

Ltrim (String)

Rtrim (String)

Trim (String)

The necessary String parameters can be any valid string expression. If string contains NULL, NULL will be returned.

MID function

Returns Variant (String), which contains a specified number of characters in the string.

grammar

MID (String, Start [, Length])

The syntax of the MID function has the following naming parameters:

Part of the String necessary parameters. String expressions, return characters from it. If string contains NULL, NULL will be returned. START necessary parameters. For the long. The character position of the part is taken out in String. If the start exceeds the string of the string, the MID returns zero length string (""). LENGTH Optional parameters; for Variant (long). The number of characters to return. If omitted or longens exceeds the character of the text (including characters at Start), the string will return all characters from START to the end.

Description

I want to know the number of string, available by the Len function.

Note that the MIDB function acts on the byte data contained in the string, just as in a dual-byte character set (DBCS) language. Therefore, its parameters are specified by the number of bytes, not the number of characters. For sample code using MIDB, see the second example in the example topic.

Minute function

Returns a variant (Integer), its value between 0 and 59, indicating a certain minute in an hour.

grammar

Minute (time)

The necessary Time parameters can be any variant, numerical expressions, string expressions, or a combination thereof that can be expressed. Returns NULL if the time contains NULL.

MIRR function

Returns a Double, specifying the internal interest rate of a series of modified periodic cash flow (expenditures or income).

grammar

Mirr (VALUES (), FINANCE_RATE, REINVEST_RATE) MIRR function has the following naming parameters:

Partially describes values ​​() necessary. Double array, specify cash flow value. This array is at least a negative value (payment) and a positive value (income). FINANCE_RATE is necessary. Double specifies the payment rate on financial costs. Reinvest_Rate is necessary. Double specifies the interest rate of income by cash.

Description

Modified returned internal interest rates refer to internal interest rates when calculating spending and income in different interest rates. The MIRR function considers both investment costs and considers the interest rate of cash re-investment (Reinvest_Rate).

The Finance_Rate and Reinvest_Rate parameters are percentage of decimal value. For example, 0.12 represents 12%.

The MIRR function explains the order of payment and income with numerical order in an array. To ensure that the input order of payments and income is correct.

Month function

Returns a Variant (Integer), its value is an integer between 1 and 12, indicating a month of one year.

grammar

Month (Date)

The necessary DATE parameters can be any variant, numerical expressions, string expressions, or their combinations that can represent the date. Returns NULL if Date contains NULL.

MONTHNAME function

description

Returns a string representing the specified month.

grammar

Monthname (Month [, Abbreviate])

The Monthname function syntax has the following sections:

Partially describes Month necessary. Numerical representation of the month. For example, January is 1, February is 2, and so on. Abbreviate is optional. The Boolean value indicates whether the month name is abbreviated. If ignored, the default value is false, indicating that the month name cannot be abbreviated.

MSGBOX function

Display a message in the dialog, wait for the user to click the button and return an Integer tells the user which button is clicked.

grammar

Msgbox (Prompt [, Buttons] [, Title] [HelpFile, Context])

The syntax of the msgbox function has the following names:

Partially describes PROMPTs necessary. String Expressions As the message displayed in the dialog box. The maximum length of the PROMPT is approximately 1024 characters, which is determined by the width of the characters used. If the content of the PROMPT exceeds a row, you can use a backclist (CHR (13)), a wrap (CHR (10)) or a combination of the return to the wrap (CHR (13) & chr (CHR (13) & chr 10)) Separate each line. Buttons is optional. The numerical expression is the sum of the value, specifies the number and form of the display button, the icon style used, the default button is, and the forced response of the message box, etc. If omitted, Buttons' default is 0. Title is optional. String expressions displayed in the dialog title bar. If Title is omitted, put the application name in the title bar. Helpfile is optional. String expressions, identifies to provide a context-related help file to the dialog. If HelpFile is provided, Context must also be provided. Context is optional. Numerical expressions, assigned by the author of the help file specified to the appropriate help topics. If Context is provided, heLpFile must also be provided.

Settings

Buttons parameters have the following settings:

The constant value describes that Vbokonly0 only displays the OK button. VBOKCANCEL1 displays OK and Cancel buttons. VbabortRetryIgnore2 displays the Abort, Retry, and Ignore buttons. Vbyesnocancel3 displays the Yes, NO and Cancel buttons. Vbyesno4 displays YES and NO buttons. VbretryCancel5 displays Retry and Cancel buttons. Vbcritical16 shows the Critical Message icon. VBQuestion32 Displays the Warning Query icon. Vbexclamation48 displays a Warning Message icon. Vbinformation64 displays the INFORMATION Message icon. The VBDefaultButton10 first button is the default. VBDefaultButton2256 The second button is the default. VBDefaultButton3512 The third button is the default. VBDefaultButton4768 The fourth button is the default. The VBApplicationModal0 application is forcibly returned; the application has been suspended until the user responds to the message box to continue. The VBSystemModal4096 system enforces it; all applications are suspended until the user responds to the message box to continue. vbMsgBoxHelpButton16384 Help button to add the specified message block VbMsgBoxSetForeground65536 message box window as the foreground window vbMsgBoxRight524288 vbMsgBoxRtlReading1048576 specified text is right-aligned in the right text should Hebrew and Arabic system to the first set value (0-5) left display Describe the type and number of the buttons displayed in the dialog; the second set value (16, 32, 48, 64) describes the style of the icon; the third set value (0, 256, 512) indicates which button is default. Value; and the fourth group value (0, 4096) determines the forced return of the message box. When these numbers generate the Buttons parameter value, only one number can be taken by each group value.

Note that these constants are specified by Visual Basic for Applications (VBA). As a result, these constant names can be used everywhere in the program code without having to use the actual value.

return value

Constant value description VBok1okvbcancel2cancelvbabort3abortvbretry4Retryvbignore5ignorevbyes6yesvbno7no

Description

When providing the HelpFile and Context, the user can press F1 to see the help topic corresponding to Context. Some host applications like Microsoft Excel will also automatically add a Help button in the dialog.

If the dialog box displays the Cancel button, press the ESC button as the CANCEL button. If there is a Help button in the dialog, context-related help is available. However, no value is returned until there is a click in other buttons.

Note If you also specify parameters other than the first named parameter, you must use MSGBox in the expression. In order to omit certain positional parameters, the corresponding comma delimiter must be added.

NOW function

Returns a Variant (date), specifies the date and time according to the date and time set by the computer system.

grammar

NOW

NPER function

Returns a Double, specifying the total number of regular fixed payments and fixed rate fixed.

grammar

NPER (Rate, PMT, PV [, FV [, Type]])

NPER functions have the following named parameters:

Partially describes the necessary. Double specifies the interest rate of each period. For example, if there is a loan annual percentage (APR) for 10% and monthly payment, the interest rate of each period is 0.1 / 12 or 0.0083. PMT is necessary. Double specifies the amount paid for each period. The payment amount usually contains the principal and interest, and the payment amount is unchanged during the validity of the annuity. PV is necessary. Double Specifies the present value of the future of a series of payments or receipts. For example, when the loan is bought a car, the amount of loans borrowed to the loan is the present value of the future payment to the credit payment. FV is optional. Variant specifies the future value or cash of the desired in the loan. For example, the future value of the loan is $ 0 after the loan is paid. However, if you want to save $ 50,000 as a child education fund in 18 years, $ 50,000 is the future value. If omitted, the default is 0. TYPE is optional. Variant specifies the loan expiration time. If the loan expires during the end of the loan cycle, use 0, if the loan expires during the cycle, please use 1. If omitted, the default is 0. Description

The annuity is a series of fixed cash payments in a period of time. The annuity can be a loan (such as a house mortgage) or a investment (such as a monthly savings plan).

For all parameters, with negative numbers (such as savings deposits), with positive numbers, cash income (such as bonus check).

NPV function

Returns a double that specifies the net current value set according to a set of periodic cash flows (payments and income) and discount rates.

grammar

NPV (Rate, Values ​​())

The NPV function has the following named parameters:

Partially describes the necessary. Double Specifies the discount rate during a period, expressed with decimal. VALUES () is necessary. Double array specifies the cash flow value. This array is at least a negative value (payment) and a positive value (income).

Description

The net present value of investment is the current value of a series of payments or income in the future.

The NPV function uses the order of the values ​​in the array to explain the order of payment and income. To ensure that the payment and revenue value are entered in the correct order.

NPV investment starts the calculation cycle before the first cash flow value, and ends the final cash flow value in the array.

The net present value is calculated according to the future cash flow. If the first cash flow occurs at the beginning of the first phase, the value returned by NPV must be added to the first value is the net present value. And the values ​​() array cannot contain the first value.

The NPV function is similar to the PV function (present value), just the PV function is allowed to have cash flow at the beginning or end of a period. Unlike variable NPV cash flow values, PV cash flow must be fixed throughout the investment.

OCT function

Returns Variant (String), represents an eight-input value of a value.

grammar

OCT (Number)

The necessary Number parameters are any valid numerical expressions or string expressions.

Description

If Number is still an integer, then goes to the closest integer before execution.

If Number returns nullnullempty zero (0) any other number of numbers of NullnulleMpty zero (0).

The appropriate range of the number prefix can directly represent the eight-way number. For example, the & O10 represents the decimal 8 of the octal representation.

Partition function

Returns a variant (string), specifying a range, which is within this range in the number specified in a series of calculations.

grammar

Partition (Number, Start, STOP, Interval)

The syntax of the Partition function contains the following name parameters:

Partially describes the necessary parameters of Number. Integer, judge whether this integer appears in all scope. START necessary parameters. Integer, value range start value, this value cannot be less than 0. STOP essential parameters. The end value of integer, numerical range, this value cannot be equal to or less than START. Description

The Partition function identifies the specific range that appears in the Number value and returns a variant (string) to describe this range. The Partition function is most useful in the query. You can create a selection query show how many orders within a few variations, for example, the order number from 1 to 1000, 1001 to 2000, and so on.

The following table uses three groups of Start, STOP, and the Interval section to show how to determine this range. The first range and the last range of two columns show the return value of the partition, the low-end (UpperValue) and the high-end (UpperValue) are separated by colon.

StartStopInterval before the first range of the first range, the last range of the last range of the last range 0995 ": -1" "0: 4" "95: 99" "100:" 2019910 ": 19" 20: 29 "190: 199 "" 200: "100101020": 99 "" 100: 119 "" 1000: 1010 "" 1011: "

From the above table, in the third line, the numerical range defined by START and STOP cannot be divided in Interval. So, even if Interval is 20, the last range can only be extended to STOP (11 numbers).

If needed, Partition will add enough blank in the returned range so that the return value has the same number of characters on the left and right sides of the colon, and its value is the number of characters in the STOP plus one. This ensures that the resulting string can be obtained in the next sort operation when the partition is used to operate with other values.

If Interval is 1, the range is Number: Number, regardless of the Start and STOP parameters. For example, if Interval is 1, Number is 100, and the STOP is 1000, then Partition will return "100: 100".

If any part is null, Partition will return a NULL.

PMT function

Returns a Double that specifies an annuity payment amount based on periodic quota payment and interest rate.

grammar

PMT (Rate, NPER, PV [, FV [, Type]])

The PMT function has the following naming parameters:

Partially describes the necessary. Double specifies the interest rate of each period. For example, if there is a loan year percentage (APR) for car loans percent and monthly payment, the interest rate per period is 0.1 / 12 or 0.0083. NPER is necessary. Integer specifies a total number of payments for an annuity. For example, if you choose a monthly payment for a four-year car loan, the loan has a total of 4 * 12 (or 48) payments. PV is necessary. Double Specifies the present value of the future of a series of payments or receipts. For example, when the loan is bought a car, the amount of loans borrowed to the loan is the present value of the future payment to the credit payment. FV is optional. Variant specifies the future value or cash of the desired in the loan. For example, the future value of the loan is $ 0 after the loan is paid. However, if you want to save $ 50,000 as a child education fund in 18 years, $ 50,000 is the future value. If omitted, the default is 0. TYPE is optional. VARIANT, specifying the loan expiration time. If the loan expires during the end of the loan cycle, use 0. Use 1 if the loan expires during the cycle. If omitted, the default is 0. Description

The annuity is a series of fixed cash payments for a period of time, and the annuity can be a loan (such as a house mortgage) or a investment (such as a monthly savings plan).

Rate and NPER parameters must be calculated using the same unit during payment. For example, if Rate calculates the month, NPER must also calculate the month.

For all parameters, with negative numbers (such as savings deposits), with positive numbers, cash income (such as bonus check).

PPMT function

Returns a Double, specifying the principal amount of the principal amounts during a periodic quota payment and the fixed rate of the fixed rate.

grammar

PPMT (Rate, Per, NPER, PV [, FV [, Type]])

The PPMT function has the following naming parameters:

Partially describes the necessary. Double specifies the interest rate of each period. For example, if there is a loan year percentage (APR) for car loans percent and monthly payment, the interest rate per period is 0.1 / 12 or 0.0083. PER is necessary. Integer Specifies the payment cycle in the NPER room range 1. NPER is necessary. Integer specifies a total number of payments for an annuity. For example, if you choose a monthly payment for a four-year car loan, the loan has a total of 4 * 12 (or 48) payments. PV is necessary. Double Specifies the present value of the future of a series of payments or receipts. For example, when the loan is bought a car, the amount of loans borrowed to the loan is the present value of the future payment to the credit payment. FV is optional. Variant specifies the future value or cash set value you want after paying the loan. For example, the future value of the loan is $ 0 after the loan is paid. However, if you want to save $ 50,000 as a child education fund in 18 years, $ 50,000 is the future value. If omitted, the default is 0. TYPE is optional. Variant specifies the loan expiration time. If the loan expires during the end of the loan cycle, use 0. Use 1 if the loan expires during the cycle. If omitted, the default is 0.

Description

The annuity is a series of fixed cash payments in a period of time. The annuity can be a loan (such as a house mortgage) or a investment (such as a monthly savings plan).

Rate and NPER parameters must be calculated using the same unit during payment. For example, if Rate calculates the month, NPER must also calculate the month.

For all parameters, with negative numbers (such as savings deposits), with positive numbers, cash income (such as bonus check). PV function

Returns a Double Specifies an annuity value that is regularly, fixed payment and fixed rate.

grammar

PV (Rate, NPER, PMT [, FV [, Type]])

The PV function has the following naming parameters:

Partially describes the necessary. Double specifies the interest rate of each period. For example, if there is a loan year percentage (APR) for car loans percent and monthly payment, the interest rate per period is 0.1 / 12 or 0.0083. NPER is necessary. Integer specifies a total number of payments for an annuity. For example, if you choose a monthly payment for a four-year car loan, the loan has a total of 4 * 12 (or 48) payments. PMT is necessary. Double Specifies the payment amount for each period. The payment amount usually contains the principal and interest, and this payment amount is unchanged during the validity of the annuity. FV is optional. Variant, specifies the future value or cash of the desired after payment. For example, the future value of the loan is $ 0 after the loan is paid. However, if you want to save $ 50,000 as a child education fund in 18 years, $ 50,000 is the future value. If omitted, the default is 0. TYPE is optional. Variant specifies the loan expiration time. If the loan expires during the end of the loan cycle, use 0. Use 1 if the loan expires during the cycle. If omitted, the default is 0.

Description

The annuity is a series of fixed cash payments in a period of time. The annuity can be a loan (such as a house mortgage) or a investment (such as a monthly savings plan).

Rate and NPER parameters must be calculated using the same unit during payment. For example, if Rate calculates the month, NPER must also calculate the month.

For all parameters, cash expenditures (such as savings deposits) are represented by negative numbers, while cash income (such as bonus check) is represented by a positive number.

QBCOLOR function

Returns a long to indicate the RGB color code of the corresponding color value.

grammar

Qbcolor (color)

The necessary COLOR parameters are intellectuals boundaries between 0 and 15.

Settings

The Color parameters have the following settings:

Value color value color 0 black 8 gray 1 blue 9 bright blue 2 green 10 bright green 3 cyan 11 bright green 4 red 12 bright red 5 magenta 13 bright red 6 yellow 14 bright yellow 7 white 15 bright white

Description

The Color parameter represents the color value of the use of earlier versions of Basic, such as Microsoft Visual Basic for MS-DOS, and Basic Compiler. Begin the minimum valid byte, the return value specifies the value of red, green, and blue, used to set the corresponding color of the RGB system in VBA.

Rate function

Returns a Double, specifying the annual interest rate of each period.

grammar

Rate (NPER, PMT, PV [, FV [, Type [, Guess]]])

The Rate function has the following naming parameters:

Partially describes NPER. Double specifies a total of payment of payments. For example, if you choose a monthly payment for a four-year car loan, the loan has a total of 4 * 12 (or 48) payments. PMT is necessary. Double, specify the payment amount for each period. The payment amount usually contains the principal and interest, and this payment amount is unchanged during the validity of the annuity. PV is necessary. Double Specifies the present value of the future of a series of payments or receipts. For example, when the loan is bought a car, the amount of loans borrowed to the loan is the present value of the future payment to the credit payment. FV is optional. Variant specifies the future value or cash of the desired in the loan. For example, the future value of the loan is $ 0 after the loan is paid. However, if you want to save $ 50,000 as a child education fund in 18 years, $ 50,000 is the future value. If omitted, the default is 0. TYPE is optional. Variant, specifying the loan expiration time, if the loan expires at the end of the loan cycle, use 0. Use 1 if the loan expires during the cycle. If omitted, the default is 0. Guess is optional. Variant Specifies the estimation value returned by Rate. If omitted, GUESS is 0.1 (10%). Description

The annuity is a series of fixed cash payments in a period of time, and the annuity can be a loan (such as a house mortgage) or a investment (such as a monthly savings plan).

For all parameters, cash expenditures (such as savings deposits) are represented by negative numbers, while cash income (such as bonus check) is represented by a positive number.

Rate is a superimposed calculation. Start with the value of Gues, the Rate repeated loops until the accuracy reaches 0.00001%. If the results cannot be obtained after 20 superimposed tests, the Rate calculates failed. If the speculation is 10% and the rate calculation fails, please try different gues. Value.

Replace function

description

Returns a string that the substring specified in the string has been replaced with another sub-string, and the number of times the replacement occurs is also specified.

grammar

Replace (Expression, Find, Replacewith [, Start [, COUNT [, Compare]]])

The replace function syntax has the following sections:

Partially describes Expression necessary. String expressions, contain the sub-string to be replaced. Find must be. The sub-string to search. Replacewith must be required. Sub strings used to replace. START is optional. In the start position of the sub-string search in the expression. If ignored, assume that starting from 1. COUNT is optional. The number of sub-strings is replaced. If ignored, the default value is -1, which indicates all possible replacement. Compare is optional. The digital value indicates the comparison method used when it is determined by the sub-string. For its value, see the "Settings Value" section.

Settings

The set value of the Compare parameter is as follows:

Constant value describes VBuseCompareOption-1 to perform comparisons using the option value of the Option Compare statement. VbinaryCompare0 performs binary comparison. VbtextCompare1 performs a text comparison. VBDatabaseCompare2 is only used for Microsoft Access. Information execution based on your database.

return value

The return value of Replace is as follows:

If the Replace Return Value Expression length is zero length string (""). Expression is a NULL. Find length is a copy of zero expression. The ReplaceWith length is a copy of zero Expression, which deletes all the strings that appear. START> LEN (Expression) String of length zero. COUNT IS 0EXPRESSION. Description

The return value of the REPLACE function is a string, however, where the position specified from Start begins, a sub-string at the end of the Expression string has been alternative. It is not a replication from the head to the end.

RGB function

Returns a long integer to represent a RGB color value.

grammar

RGB (Red, Green, Blue)

The syntax of the RGB function contains these named parameters:

Partially describes the RED necessary parameters; Variant (Integer). The value ranges from 0 to 255, representing a red ingredient of the color. Green necessary parameters; Variant (Integer). The value ranges from 0 to 255, representing the green ingredients of the color. BLUE Essential parameters; Variant (Integer). Numerical ranges from 0 to 255, representing a color of the color.

Description

The method and attribute of an application that can accept color descriptions is expected to be a value representing the RGB color value. A RGB color value specifies the relative brightness of red, green, and blue three original colors, generating a specific color for display.

The value of any parameter passed to the RGB, if more than 255, will be treated as 255.

The following table shows some common standard colors, as well as these colors of red, green, and blue three original ingredients:

Color red value Green value lace color value black 000 blue 00255 green 02550 cyan 0255255 red 25500 magenta 2550255 Yellow 2552550 White 255255255

Right function

Returns Variant (String), which contains the specified number of characters removed from the string of strings.

grammar

Right (String, Length)

The syntax of the Right function has the following naming parameters:

Part of the String necessary parameters. String expressions, the rightmost characters will be returned. If string contains NULL, NULL will be returned. Length necessary parameters; for Variant (long). For numerical expressions, point out how many characters want to return. If 0, return zero length string (""). Returns the entire string if it is greater than or equal to String characters.

Description

I want to know the number of characters in the String, with the LEN function.

Note that the Rightb function acts on byte data contained in the string. So the length specifies the number of bytes instead of specifying the number of characters returned.

RND function

Returns a Single containing a random value.

grammar

RND [(Number)]

Optional Number parameters are Single or any valid numerical expression.

return value

If the value of Number is the RND generation less than 0, Number is used as the same result obtained by using Number as a random number. The next random number is greater than 0 sequence. Mix 0 recently generated number. The next random number in the sequence is omitted.

Description

The RND function returns a value of less than 1 but greater than or equal to 0.

The value of Number determines how the RND generates a random number.

The originally given seeds generate the same number, because each calling the RND function uses the previous number of the previous number as the next number of seeds.

Before calling the RND, first initialize the random number generator using the non-parametric Randomize statement, which has the seed obtained according to the system timer.

In order to generate a random integer within a range, the following formula can be used:

INT (UpperBound - LowerBound 1) * RND LowerBound) Here, UpperBound is the upper limit of random number, and LowerBound is the lower limit of random number.

Note If you want to get a repeated random number sequence, the RND with the negative parameter value is directly called before using the randomize with numeric parameters. Use the Randomize with the same Number value that does not get duplicate random number sequences.

Round function

description

Returns a value, which is the result of rounding the calculation according to the specified number of decimal numbers.

grammar

Round (Expression [, NumDecimalPlace])

Round function syntax has the following sections:

Partially describes Expression necessary. To make a numerical expression of the rounded operation. NumDecimalPlace is optional. Digital value, indicating that the number of digits should be retained on the right side of the decimal point. If ignored, the Round function returns an integer.

SECOND function

Returns a Variant (Integer), its value between 0 and 59, indicating a second in one minute.

grammar

SECOND (TIME)

The necessary Time parameters can be any variant, numerical expressions, string expressions, or a combination thereof that can be expressed. Returns NULL if the time contains NULL.

SEEK function

Returns a long, specify the current read / write location in the file open in the Open statement.

grammar

Seek (Filenumber)

The necessary FILENUMBER parameter is an Integer that contains a valid file number.

Description

The SEEK function returns a value between 1 and 2, 147, 483, 647 (equivalent to 2 ^ 31 - 1).

The return value for various file access methods is as follows:

Mode Return the record number of the next read or written in Random. Binary, Output, Append, Input The next operation will occur when you are in. The first byte in the file is located in position 1, and the second byte is located at position 2, and so on.

SGN function

Returns a variant (Integer) indicating the correct number of parameters.

grammar

SGN (Number)

The necessary Number parameters are any valid numerical expression.

return value

If Number returns to SGN, it is more than 01 equal to 00 less than 0-1

Description

The symbol of the NUMBER parameter determines the return value of the SGN function.

Shell function

Perform an executable file, return a variant (double), if successful, representing the task ID of this program, if it is not successful, it will return 0.

grammar

Shell (Pathname [, WindowStyle])

The syntax of the shell function contains the following name:

Partially describes the necessary parameters of the Pathname. Variant (string), the program name to be executed, as well as any required parameters or command line variables, may also include a directory or folder, and a drive. WindowStyle optional parameters. Variant (Integer) indicating the style of the running window in the program. If WindowsTyle omits, the program is performed in a minimized window with focus.

WindowStyle Name Parameters have the following values:

Constant Value Description The VBHIDE0 window is hidden, and the focus will move to implicit window. The VBNORMALFOCUS1 window has focus and reduces it to its original size and location. The VBMinimizedFocus2 window will display in an icon with focus. The VBMaximizedFocus3 window is a maximum window with focus. The VBNORMALNOFOCUS4 window will be restored to the most recently used size and location, while the currently active window remains active. The VBMinimizednofocus6 window will display in an icon. The current window of events remains active. Description

If the shell function successfully executes the file to be executed, it returns the task ID of the program. Task ID is a unique value to indicate that the program is running. If the shell function cannot open a named program, an error will occur.

Note that by default, the shell function performs other programs asynchronous. That is, the program that is started with shell may have not completed the execution process, and the statement after the shell function has been executed.

SIN function

Returns a Double, specifying the SINE (sinusoidal) value of the parameter.

grammar

Sin (Number)

The necessary Number parameters are Double or any valid numerical expression indicating a angle in an arc.

Description

The SIN function takes a angle to the parameter value, and returns the ratio of the side length of the side to the length of the slope.

The results range from -1 to 1.

In order to convert the angle to an arc, multiply the angle with PI / 180. In order to convert the arc to an angle, multiply the arc by 180 / pi.

SLN function

Returns a Double, designated a straight line depreciation of an asset in the first phase.

grammar

SLN (Cost, Salvage, Life)

The SLN function has the following naming parameters:

Part of the description of Cost is necessary. Double specifies the initial cost of the asset. SALVAGE is necessary. Double specifies the value of the asset after the end of the available age. Life is necessary. Double specifies the available age of the asset.

Description

During the depreciation period, you must use the same unit as the Life parameter. All parameters must be positive.

Space function

Returns Variant (String) of a specific number of spaces.

grammar

Space (Number)

The necessary Number parameters are the number of spaces you want in the string.

Description

Space functions are useful when the format outputs or clears fixed length string data.

SPC function

Wipe with the Print # statement or Print method, position the output.

grammar

SPC (N)

The necessary n parameters are the number of blank numbers before the next expression in the display or print list.

Description

If n is smaller than the width of the output row, the next print position will follow after several printed gaps. If N is greater than the width of the output line, the SPC uses the following formula to calculate the next print position:

CurrentPrintPosition (n mod width)

For example, if the current output position is 24, the width of the output row is 80, and the SPC (90) is specified, then the next print starts from position 34 (the remainder of the current print position 90/80). If the difference between the current print position and the output row width is less than N (or N mod ", the SPC function will jump to the beginning of the next row and generate a blank of N-(Width - UrrentPosition).

Note To ensure that the table bar width is sufficient to accommodate a wide string.

When the PRINT method is used with the spacing font, the width of the space character printed using the SPC function is always equal to the average width of all characters in the font in the font. However, there is no relationship between the number of printed characters and the number of associated columns occupied by those characters. For example, uppercase English letter W occupies more than a set of columns, and lowercase letters I occupy less than one depth column. Split function

description

Returns a one-dimensional array starting from zero, which contains a specified number of subtroke.

grammar

Split (expression [, delimiter [, count [, compare]]])

Split function syntax has the following sections:

Partially describes Expression necessary. Contains a string expression of a sub-string and a separator. If Expression is a string ("") of a length zero (""), Split returns an empty array, that is, an array without elements and data. Delimiter is optional. String characters for identifying sub-string boundaries. If ignored, the space character ("") is used as a separator. If Delimiter is a string with a length of zero, the returned array contains only one element, that is, a complete Expression string. COUNT is optional. The number of subtrips to return, -1 indicates that all sub-strings are returned. Compare is optional. The digital value indicates the comparison method used when it is determined by the sub string. For its value, see the "Settings Value" section.

Settings

The set value of the Compare parameter is as follows:

Constant value description VBuseCompareOption-1 performs comparison with the set value in the Option Compare statement. VbinaryCompare0 performs binary comparison. VbtextCompare1 performs a text comparison. VBDatabaseCompare2 is only used for Microsoft Access. Information execution based on your database.

SQR function

Returns a double root of the specified parameter.

grammar

SQR (Number)

The necessary NUMBER parameter Number is Double or any valid value greater than or equal to 0 numerical expression.

STR function

Returns a Variant (String) representing a value.

grammar

STR (Number)

The necessary Number parameters are a long, which can contain any valid numerical expressions.

Description

When a digital is converted to a string, a hollow will always be left in the front. If Number is positive, the returned string contains a positive sign in a front guide.

Using the Format function can convert numeric values ​​to the necessary format, such as dates, time, currency, or other user-defined formats. Unlike the STR, the Format function does not include the front guide felt to place Number's login.

Note that the STR function is only a vivo point. If you use different decimal points (for example, international applications), you can use CSTR to convert numbers into strings.

Strcomp function

Returns Variant (Integer) to compare the string.

grammar

STRComp (string1, string2 [, compare])

The syntax of the strComp function has the following name parameters:

Some explain the necessary parameters of String1. Any valid string expression. String2 necessary parameters. Any valid string expression. COMPARE Optional parameters. Specifies the type of string comparison. If the Compare parameter is NULL, an error will occur. If compare, the setting of the Option Compare will determine the type of comparison.

Set

The COMPARE parameter is set to:

Constant Value Description VBuseCompareOption-1 Executes a comparison with the OPTION COMPARE statement. VbbonaryCompare0 performs a binary comparison. VbtextCompare1 performs a comparison of the original text. VBDatabaseCompare2 applies only to Microsoft Access, performing a comparison based on database information. return value

The strcomp function has the following return value:

If strcomp returns String1 less than string2-1string1 equal to String20String1 greater than String21String1 or String 2 is nullnull

STRCONV function

Returns Variant (String) converted by specified type.

grammar

Strconv (String, Conversion, LCID)

The syntax of the StrConv function has the following naming parameters:

Part of the String necessary parameters. String expressions to be converted. Conversion necessary parameters. Integer. The value of its value and determine the type of conversion. LCID is optional. If the system localeid is different, LocaleId is the default value.)

Settings

The set value of the Conversion parameter is:

Constant value Description VBupPercase1 converts the string text to uppercase. vblowercase2 converts string text to lowercase. VBPropercase3 converts the beginning letter of each word in the string to uppercase. VBWIDE * 4 * converts the single-byte character in the string to a double-byte character. VBNARROW * 8 * converts the double-byte character in the string into a single-byte character. VBKATAKANA ** 16 ** Turn a string in a string to a slice fake name character. Vbhiragana ** 32 ** Turn the string in a fake name character to a parity name. Vbunicode64 converts strings into Unicode based on the default code page of the system. VBFromunicode 128 The string is converted from Unicode to the default code page.

* Apply to the distant country.

** is applied to Japan.

Note that these constants are specified by VBA. They can be used to replace the true value in the program. Most of them can be combined, such as vbuppercase vbwide, mutually exclusive constants that cannot be combined, such as Vbunicode VBFromunicode. When a constant VBWIDE, VBNARROW, VBKATAKANA, and VBHIRAGANA are used in unable, it will cause runtime errors.

Here are some of the general cases of effective delimiter: NULL (CHR $ (0)), horizontal tabs (CHR $ (9)), wrap (CHR $ (10)), vertical tabs (CHR $ (11) )), Switching (CHR $ (12)), Enter (CHR $ (13)), blank (SBCS) (CHR $ (32)). In DBCS, the actual value of the blank will be different from the country.

Description

When converting the BYTE array of the ANSI format into a string, you should use the StrConv function. Use the assignment statement when you convert this array in the Unicode format.

Strreverse function

description

Returns a string, one of the character sequences of a specified sub-string is reverse.

grammar

Strreverse (String1)

The parameter string1 is a string, and its character sequence is reversed. If String1 is a string ("") of a length zero, it returns a string of length zero. If String1 is NULL, an error is generated.

String function

Returns Variant (String), which contains a string that specifies the length of the character.

grammar

String (Number, Character)

The syntax of the String function has the following naming parameters:

Part Illustrate the necessary parameters of Number; long. The returned string length. If NUMBER contains NULL, NULL will be returned. CHARACTER Essential parameters; Variant. For the character code or string expression of the specified character, the first character will be used to establish a returned string. If the Character contains NULL, it returns NULL. Description

If the value of the character is greater than 255, String will turn it into a valid character code by following the formula below:

Character MOD 256

Switch function

Calculate a value of a set of expression lists and return to the Variant value or expression associated with the expression of TRUE in the express list.

grammar

Switch (expr-1, value-1 [, expr-2, value-2 _ [, expr-n, value-n]])

The syntax of the Switch function has the following parts:

Some describe the EXPR necessary parameters. Variant expression to be calculated. Value necessary parameters. If the associated expression is true, the value or expression of this section is returned.

Description

The parameter list of the Switch function consists of multi-pair expressions and values. The expression is calculated from left to right, and the value returns when the first associated expression is TRUE. If some of them is not pair, a runtime error will occur. If EXPR-1 returns Value-1 for True, if EXPR-1 is false, but expr-2 is true, Switch returns Value-2 to push it.

Switch will return a NULL value if:

No expression is true. The first expression of TRUE, which corresponds to NULL.

Although it only returns one of the values, Switch calculates all expressions. Therefore, it should be noted that the aspects of side effects should be noted. For example, an error occurs as long as one of the expressions cause the zero error error.

SYD function

Returns a Double, specifying a depreciation of an asset using the total number of years during a designation.

grammar

SYD (COST, SALVAGE, LIFE, PERIOD)

The SYD function has the following naming parameters:

Part of the description of Cost is necessary. Double specifies the initial cost of the asset. SALVAGE is necessary. Double specifies the value of the asset after the end of the available age. Life is necessary. Double specifies the available age of the asset. PERIOD is necessary. Double Specifies the time used in calculating the asset depreciation.

Description

The Life and Period parameters must be represented by the same unit. For example, if the LIFE is represented by the month, PERIOD must also be represented by the month. All parameters must be positive.

Tab functions

Wipe with the Print # statement or Print method, position the output.

grammar

Tab [(n)]

Optional n parameters are the number of columns that move prior to the next expression in the display or print list. If this parameter is omitted, the TAB moves the insertion point to the starting point of the next print area. This makes Tabs can be used to replace the comma in the country, here, the comma is used as a decimal separator.

Description

If the print position on the current line is greater than n, the Tab moves the print position on the N-column of the next output line. If n is less than 1, the Tab moves the print position to the column 1. If n is greater than the width of the output row, the Tab function calculates the next print position using the following formula:

N mod width

For example, if width is 80, and specify Tab (90), the next print will start from column 10 (90/80). If n is smaller than the current print position, print from the print position calculated from the next row. If the calculated print position is greater than the current print position, print from the print position calculated from the same row. The uppermost print position of the output row is always 1. When using the Print # statement to write the data into the file, the rightmost print position is the current width of the output file, which is available in width # statement.

Note To ensure that the width of the table column is sufficient to accommodate a wide string.

When the print method is used with the Tab function, the appearance of the printed will be split into uniform and wide columns. The width of each column is equal to the average width of all characters in the font in the font. However, there is no relationship between the number of printed characters and the number of associated columns occupied by those characters. For example, uppercase letter W occupies more than a set of columns, and lowercase letters I occupy less than one wide column.

Tan function

Returns a value of a Double, specifying the positive cut value of a corner.

grammar

Tan (Number)

The necessary NUMBER parameters are Double or any valid numerical expression indicating an angle in an arc.

Description

Tan takes a angle as a parameter value and returns the ratio of two neighbors of the right angle. This ratio is a business that is adjacent to the edge of the angle.

In order to convert the angle into an arc, multiply the angle with PI / 180/180. In order to convert the arc to an angle, multiply the arc by 180 / pi.

Time function

Returns a Variant (date) indicating the current system time.

grammar

Time

Description

In order to set the system time, use the TIME statement.

Timer function

Returns a Single that represents the number of seconds after the midnight begins.

grammar

Timer

Description

In Microsoft Windows, the Timer function returns a second fractional portion.

TimeSerial function

Returns a variant (date) containing a specific time, minute, second.

grammar

TimeSerial (Hour, Minute, Second)

TimeSerial function syntax has the following naming parameters:

Partial description HOUR is necessary; Variant (Integer). Its value is from 0 (12:00 A.M.) to 23 (11:00 p.m.), or a numerical expression. Minute is necessary; Variant (Integer). Any numerical expression. SECOND is necessary; Variant (Integer). Any numerical expression.

Description

To specify a moment, such as 11: 59: 59, TimeSerial parameters should be in the normal range; that is, the hour point should be interposed between 0-23, while the minute and second should be between 0-59. However, when a numerical expression indicates a certain time, minutes, minutes or seconds, or may specify a relative time for each parameter using this numerical expression. The expression is used instead of an absolute time number in the following example. The TimeSerial function returns 6 hours (12 - 6) and fifteen minutes before noon, that is, 5:45:00 A.m.

TimeSerial (12 - 6, -15, 0)

When any one of the parameters exceeds the normal range, it will carry out the next larger time unit. For example, if 75 (75 minutes) is specified, this time is interpreted for an hour and fifteen points. If a parameter value exceeds -32, 768 to 32, 767, it will cause errors. If the time specified by three parameters will make the date exceed the acceptable date range, it will also cause errors.

The TimeValue function returns a Variant (date) that contains time.

grammar

TimeValue (TIME)

The necessary Time parameters are usually a string expression, representation between 0:00:00 (12:00:00 A.m.) to 23:59:59 (11:59:59 p.m.). However, TIME may also be any other expression indicating value in the same time range. Returns NULL if the time contains NULL.

Description

You can use a 12-hour or 24-hour time format. For example, "2: 24 pm" and "14:24" are effective TIME expressions.

If the TIME parameter contains date information, TimeValue will not return it. However, if the time contains invalid date information, it will cause an error to occur.

Type conversion function

Each function can enforce an expression into a particular data type.

grammar

CBOOL (Expression)

CBYTE (Expression)

CCUR (Expression)

CDATE (Expression)

CDBL (Expression)

CDEC (Expression)

CINT (Expression)

CLNG (Expression)

CSNG (Expression)

CSTR (Expression)

Cvar (Expression)

CSTR (Expression)

The necessary Expression parameters can be any string expressions or numerical expressions.

Return type

The function name determines the return type as follows:

Function Return Type Expression Parameter Range CBool ​​Boolean Any valid string or numerical expression. CBYTE BYTE0 to 255. CCurcurrency-922, 337, 203, 685, 477.5808 to 922, 337, 203, 685, 477.5807. CDatedate Any valid date expression. The number of negatives from -1.79769313486232E308-1347E-324; positive number from 4.9465645841247E-324 to 1.79769313486232E308. CDecdecimal zero ratio value, ie there is no small digit value, /- 79, 228, 162, 514, 264, 337, 593, 543, 950, 335. For the value of 28 decimals, the scope is /- 7.9228162514264337593543950335; Minimal possible non-zero value is 0.0000000000000000000000000000001. Cintinteger-32, 768 to 32, 767, the fractional part is rounded. CLNGLONG-2, 147, 483, 648 to 2, 147, 483, 647, the fractional portion is rounded. The CSNGSingle negative is -3.402823E38 to -1.401298E-45; positive number is 1.401298E-45 to 3.402823E38. CSTRSTRING returns CSTR based on the Expression parameter. If CVARVARIANT is values, the range is the same as Double; if not values, the range is the same as String.

Description

An error will occur if the Expression passing to the function exceeds the range of the conversion target data type.

Typically, the data type conversion function can be used when encoding, reflecting the result of certain operations should be represented as a specific data type, not the default data type. For example, when a single precision, bipular precision, or integer operation occurs, use CCUR to enforce currency operations.

The data type conversion function should be used instead of VAL so that the international version of data conversion can be converted from one data type to another. For example, when using CCUR, different decimal point separators, thousands of ingredients, and various monetary options, according to the country's country settings are properly identified. When the decimal portion is 0.5, the CINT and CLNG functions convert it to the closest even value. For example, 0.5 converted to 0, 1.5 converted to 2. The CINT and CLNG functions are different from the FIX and INT functions, the FIX and INT functions will truncate the decimal part instead of the round. And the FIX and INT functions always return the same value as the incoming data type.

Using the Isdate function, it can be determined whether the DATE can be converted to a date or time. CDATE can be used to identify the date text and time text, and the values ​​that fall within the acceptable date range. When converting a number becomes a date, the integer part is converted to the date, and the decimal part is converted to the time at midnight.

CDATE determines the format of the date based on country settings on the system. If the format is provided is an unrecognizable date setting, the order of the year, month, and day cannot be correctly judged. In addition, long-term formats, if there is a string with weeks, it cannot be identified.

The CVDATE function also provides compatibility for early Visual Basic versions. The syntax of the CVDate function is exactly the same as the CDATE function. However, cvdate is returns a variant, its subtype is DATE, not the actual DATE type. Because there is now a real DATE type, Cvdate is no longer needed. Convert an expression to become Date, then assign a value to a variant, or the same effect can also be achieved. You can also use this technique to convert other real data types to peer-to-peer Variant subtypes.

Note that the CDEC function cannot return a stand-alone data type, but always returns a variant, which has been converted to the Decimal subtype.

Typename function

Returns a String, providing information about variables.

grammar

Typename (varName)

The necessary VarName parameters are a Variant that contains any variables other than the user-defined type variable.

Description

The string returned by TypenAme can be any string listed below:

Returns String Variable Object Type Type ObjectType Object BYTE Bits Integer Integer LONG Long Integer Single Single Quick Floating Point Double Double Floating Point Currency Currency Decimal Date Value Date Date String String Booler Value Error Error Empty Empty Not Initialization NULL Invalid Data Object Objects Unknown Type Unknown Object Nothing No longer reference object variable

If VarName is an array, the returned string can be any possible return string (or variant) that adds nozzle added nikhon. For example, if VarName is an integer array, TypenAme returns "Integer ()".

Ubound function

Returns a long-type data that is the maximum subscript of the specified array dimension.

grammar

Ubound (arrayname [, dimension])

The syntax of the Ubound function contains the following:

Partially describes ArrayName necessary. The name of the array variable follows the standard variable naming convention. Dimension optional; Variant (long). Specifies which one of which dimension is returned. 1 Represents the first dimension, 2 means a second dimension, and so on. If Dimension is omitted, it is considered to be 1.

Description

The Ubound function is used with the LBound function to determine the size of an array. LBound is used to determine the upper bound of a certain dimension of arrays. For arrays with the following dimensions, the return value of Ubound is shown in the table below:

DIM A (1 to 100, 0 to 3, -3 to 4)

Statement Return Value Ubound (a, 1) 100ubound (A, 2) 3ubound (A, 3) 4

Ucase function

Returns Variant (String), which contains strings that are converted to uppercase.

grammar

Ucase (String)

The necessary String parameters are any valid string expressions. If string contains NULL, NULL will be returned.

Description

Only lower-write letters will be turned to uppercase; the original uppercase or non-alphabetic characters remain unchanged.

VAL function

Returns the numbers contained in the string, and the string is an appropriate type of value.

grammar

Val (String)

The necessary String parameters can be any valid string expression.

Description

The VAL function stops reading a string on the first character that cannot be identified as a number. Symbols and characters that are considered to be a number of values, such as the mood and comma, can not be identified. However, the function can identify the entry system symbol & (octal) and & H (hexadecimal). Blank, tabors and newlines are removed from the parameters.

The following return value is 1615198:

Val ("1615 198th Street N.e.")

In the following code, VAL returns a decimal value -1 to the hexadecimal value shown.

VAL ("& HFFF")

Note that the VAL function will only use the period (.) As an available decimal separator. When using different decimal separators, such as in the international application, in order to convert the string into numbers in CDBL.

VARTYPE function

Returns an Integer, pointing out the subtype of the variable.

grammar

VARTYPE (VarName)

The necessary VarName parameters are a variant that contains any variables other than the user-defined type variable.

return value

Constants described vbEmpty0Empty (uninitialized) vbNull1Null (no valid data) vbInteger2 vbLong3 Integer Integer vbSingle4 vbDouble5 single precision floating point double precision floating point value vbDate7日期 vbString8 vbCurrency6 currency string objects vbError10 vbObject9 error value vbBoolean11 Boolean vbVariant12Variant (and only becomes The array in the body is used together) VBDataObject13 Data Access Object VBDecimal14 Detailed value VBYTE17 bit value vbuserDefinedType36 contains user-defined variables VBARRAY8192 array

Note that these constants are specified by Visual Basic for the application. These names can be used everywhere in the program code to replace the actual value.

Description

The VARTYPE function itself never returns a value for VBarRay. VARTYPE always adds some other values ​​to indicate a specific type of array. Constant VBVARIANT is only returned with VBARRAY to indicate that the parameter of the VARTYPE function is an array of Variant types. For example, the return value for an array is VBINTEGER VBARRAY, or 8194. If an object has a default attribute, VARTYPE (Object) returns the type of object default attribute.

Weekday function

Returns a Variant (Integer) that contains an integer that represents a date.

grammar

Weekday (Date, [Firstdayofweek]) WeekDay function syntax has the following naming parameters:

Partial description Date is necessary. It is possible to represent a variant, numerical expression, string expression, or a combination thereof. Returns NULL if Date contains NULL. Firstdayofweek is optional. Specifies the constant on the first day of the week. If not specified, VBSunday is the default value.

Set

The firstdayofweek parameter has the following settings:

The constant value describes VbuseSystem0 Use the NLS API settings. VBSunday1 Sunday (Default) VBMonday2 Monday VBTESDAY3 Tuesday Vbwednesday4 Wednesday VBThursday 5 Thursday Vbfriday6 Friday VBSATURDAY7 Saturday

return value

The WeekDay function can return the following values:

Constant value description VBSunday1 Sunday vbmonday2 Monday VBTESDAY3 Tuesday VBwednesday Wednesday VBTHURSDAY5 Thursday Vbfriday6 Friday VBSATURDAY7 Saturday

WeekdayName function

description

Returns a string that represents a day in a week.

grammar

WeekdayName (Weekday, Abbreviate, Firstdayofweek)

WeekdayName function syntax has the following sections:

Partial description Weekday must be required. The digital value indicates a certain day in a week. This numeric value is determined depending on the setting value in the FirstdayOfWeek setting. Abbreviate is optional. The Boolean value indicates whether the name of the week is abbreviated. If this value is ignored, the default value is false, indicating that the week's name cannot be abbreviated. Firstdayofweek is optional. The digital value indicates the first day of the week. For its value, see the "Settings Value" section.

Settings

The firstdayofweek parameter value is as follows:

Constant Value Description VbuseSystem0 uses the National Language Support (NLS) API setting value. Vbsunday1 Sunday (default). Vbmonday2 Monday VBTESDAY3 Tuesday Vbwednesday Wednesday VBTHURSDAY5 Thursday Vbfriday6 Friday VBSATURDAY7 Saturday

Year function

Returns Variant (Integer) that contains an integer representing the year.

grammar

Year (date)

The necessary DATE parameters can be any variant, numerical expressions, string expressions, or their combinations that can represent the date. Returns NULL if Date contains NULL.

Arithmetic operator

^ Operator

* Operator

/ Operator

/ Operator

MOD operator

Operator

- operator

Connection operator

& Operators

Operator

Conversion function

ASC function

CBOOL function

CBYTE function

CCUR function

CDATE function

CDEC function

CDBL function

CHR function

CINT function

CLNG function

CSNG function

CSTR function

Cvar function

CVERR function

Format function

HEX function

OCT function

STR function

VAL function

Data Type Overview

The following table shows the supported data type and the storage space size and scope.

Data Type Storage Space Size Byte1 bytes 0 to 255Boolean2 bytes True or Falseinteger 2 bytes - 32,768 to 32,767long (long integer) 4 bytes -2, 147, 483, 648 to 2, 147, 483, 647single (single precision floating point) 4 From -3.402823E38 to -1.401298E-45 to -1.401298E-45 to -1.401298E-45 to 3.402823E38DOUBLE (double precision floating point) from 1.401298E-45 to 3.402823129313486232E308 to -4.94065645841247E-324 ; when (integer turns ratio) 8 bytes without a decimal point from positive to 1.79769313486232E308Currency 4.94065645841247E-324 from -922,337,203,685,477.5808 to /- 79,228,162,514,264,337,593,543,950,335 922,337,203,685,477.5807Decimal14 bytes, and the right of the decimal point median 28 /-7.92281625142643335; Minimum non-zero value /- 0.000000000000000000000000000001DATE8 bytes January 1 to 9999 December 31 Object4 bytes Any Object reference String 10 bytes plus string length 0 to about 2 billion string (fixed length) String length 1 to about 65, 400Variant (number) 16 bytes of any digital value, the maximum Double Double Double Range Variant (Character) 22 byte plus string length and becomes long String has the same range of users custom (using Type) All elements The range of each element is the same as the range of its own data type. Note An array of any data type requires 20 bytes of memory space, plus 4 bytes of each array dimension, plus the space occupied by the data itself. The memory space occupied by the data can be calculated by multiplying the size of each element by the number of data metades. For example, data in a one-dimensional array composed of four 2 bytes of Integer data is 8 bytes. These 8 bytes plus additional 24 bytes such that the total memory space required for this array is 32 bytes.

Variant containing an array requires more than 12 bytes than a separate array.

Export mathematical function

The following is a list of non-basic mathematical functions, can be exported by basic mathematical functions:

Formula SECANT (X) = 1 / COS (X) COSECANT (X) cosec (x) = 1 / sin (x) cotangent (余切) cotan (x) = 1 / TAN (X) Inverse Sine (Anti-String) Arcsin (x) = ATN (X / SQR (-x * x 1)) Inverse Cosine Arccos (x) = ATN (-X / SQR (-x * X 1)) 2 * ATN (1) Inverse Secant Arcsec (x) = ATN (X / SQR (x * x - 1)) SGN ((x) - 1) * (2 * ATN (1)) Inverse Cosecant Arccosec (x) = ATN (X / SQR (x * x - 1)) (SGN (X) - 1) * (2 * ATN (1)) Inverse Cotangent (Anti-repeated cut) Arccotan (X) = ATN (X) 2 * ATN (1) HyperBolic Sine (Double Strove) HSIN (X) = (Exp (x) - Exp (-x)) / 2 Hyperbolic Cosine Double Cosine) HCOS (X) = (Exp (X) Exp (-x)) / 2HyperBolic Tangent HTAN (X) = (Exp (x) - Exp (-x)) / (Exp (Exp) / (Exp (Exp (EXP) X) Exp (-X)) HyperBolic Secant HSEC (X) = 2 / (Exp (x) Exp (-X)) Hyperbolic Cosecant HCOSEC (X) = 2 / (Exp (x) - exp (-x)) HyperBolic Cotangent (Double Double Double) Hcotan (X) = (Exp (x) Exp (-X)) / (Exp (x) - Exp (-x) ) Inverse hyperbolic sine (anti-double sine) HARCSIN (X) = log (x SQR (x * x 1)) inverse hyperbolic cosine HARCCOS (X) = log (x SQR (x * X - 1)) Inverse Hyperbolic Tangent Anti-double dicing) HARCTAN (X) = log ((1 x) / (1 - x)) / 2INVERSE HYPERBOLIC Secant Harcsec (x) = log ((SQR (-x * x 1) 1) / x) Inverse hyperbolic cosecant HARCCOSEC (X) = log ((SGN (X) * SQR (x * x 1) 1) / x) Inverse Hyperbolic Cotangent (reverse Harccotan (X) = log ((x 1) / (x - 1)) / 2 LogN (X) =

Log (x) / log (n) logical operator

And operator

EQV operator

IMP operator

NOT operator

OR operator

XOR operator

Mathematical function

ABS function

ATN function

COS function

EXP function

FIX function

INT function

Log function

RND function

SGN function

SIN function

SQR function

Tan function

Export mathematical function

Operator priority order

When a number of operations are performed in an expression, each portion is calculated in a predetermined order, said this order is the priority order of the operator.

In the expression, when the operator is more than one, the arithmetic operator must be processed, then the comparison operator is processed, and then the logical operator is processed. All priorities of all comparison operators are the same; that is, to process left to right from left to right according to the order they appear. The arithmetic operator and logical operator must be processed in the following priority:

Arithmetic comparison logic index operation (^) equal (=) NOT negative (-) inequal (<>) AND Multiplication and division (*, /) less than (<) OR integer division (/) greater than (>) xor mode operation (MOD) less than or equal (<=) EQV addition and subtraction ( , -) greater than or equal (> =) Imp string (&) LIKEIS

Each calculation is calculated in the order of left to right when multiplication and dividing occurs in the expression. Each calculation is also calculated in the order of left to right when multiply and division occurs in the expression. You can change priority in parentheses, and some parts of the expression are prioritized. The calculations in parentheses are always preferred in the brackets. However, within parentheses, the priority order of the operator is unchanged.

String Connect Operators (&) are not arithmetic operators, however, in terms of its priority, it is before all arithmetic operators, but before all comparison operators.

LIKE's priority is the same as all comparison operators, actually a mode matching operator.

The IS operator is a comparison operator referenced by an object. It does not compare the values ​​of objects or objects, and only two object references are referenced to the same object.

Operator summary

The operator describes the arithmetic operator for operators for mathematical calculations. The comparison operator is used to compare the operator. Connect the operator to merge the operator of the string. The logical operator is used to perform the operator of the logical operation.

Array keyword summary

The function keyword confirms an array. Isarray creates an array. Array changes the default minimum. Option Base declaration and initialization array. DIM, Private, Public, Redim, Static Judging the Array Limit Limit. LBound, Ubound reinitializes an array. ERASE, Redim

Collection Object Keyword Summary

The function keyword confirms an array. Isarray creates an array. Array changes the default minimum. Option Base declaration and initialization array. DIM, Private, Public, Redim, Static Judging the Array Limit Limit. LBound, Ubound reinitializes an array. ERASE, Redim

Compile Command Keyword Summary

The role keyword defines the compilation constant. #Const Compile The selection block in the program code. #If ... Then ... # else

Control flow keyword summary

Role keyword branch. Gosub ... Return, Goto, ON ERROR, ON ... GOSUB, ON ... GOTO exits or suspended the program. DOEvents, End, Exit, STOP cycle. DO ... LOOP for ... Next, For Each ... Next, While ... Wend, with Judgment. Choose, IF ... Then ... Else, Select Case, Switch Usage Process. Call, Function, Property Get, Property Let, Property Set, SUB

Transform keyword summary

The role keyword ANSI value is transformed into a string. CHR size write transformation. Format, Lcase, ucase dates into a digital string. DateSerial, DateValue Digital Reform. HEX, OCT value transform is a string. Format, STR data type transformation. CBOOL, CBYTE, CCUR, CDATE, CDBL, CDEC, CINT, CLNG, CSNG, CSTR, CVAR, CVERR, FIX, INT date transformation. Day, month, weekday, year time transformation. Hour, Minute, Second String To ASCII Value. ASC string transform is numerical. VAL time transform is a numeric string. TimeSerial, TimeValue Data Type Keyword Summary

Role keyword data type transformation. CBOOL, CBYTE, CCUR, CDATE, CDBL, CDEC, CINT, CLNG, CSNG, CSTR, CVAR, CVERR, FIX, INT Setting data type. Boolean, Byte, Currency, Date, Double, Integer, Long, Obect, Single, String, Variant (Default) Check the data type. Isarray, Isdate, ISempty, ISERROR, ISMISSING, ISNULL, ISNUMERIC, ISOBJECT

Date and time Keyword summary

Role keyword Sets the current date or time. Date, Now, Time calculation date. Dateadd, datediff, datepart returns the date. DateSerial, DateValue Returns time. TimeSerial, TimeValue Sets date or time. Date, Time timing. Timer

Directory and file keyword summary

The role key is changed to the catalog or folder. CHDIR changes the disk. CHDRIVE copy file. FileCopy New Directory or Folder. MKDIR deletes a directory or folder. RMDIR renames files, directories, or folders. Name returns the current path. Curdir returns the date of the file, time. FileDateTime Returns file, directory, and tag properties. Getattr returns the length of the file. Filelen returns a file name or disk label. DIR Sets information about file properties. SetAttr

Error keyword summary

The function of the keyword generates a runtime error. Clear, Error, Raise acquires error message. Error provides error message. Err returns ERROR variant. CVERR runtime error handling. ON Error, Resume Type Confirm. ISerror

Financial keyword summary

Function keyword calculation depreciation rate. DDB, SLN, SYD calculates the future value. FV calculates the interest rate. Rate calculates the nature interest rate. IRR, MIRR calculation period. NPER calculation payment. IPMT, PMT, PPMT calculates the current net value. NPV, PV

Input and Output Keyword Summary

Function keyword calculation depreciation rate. DDB, SLN, SYD calculates the future value. FV calculates the interest rate. Rate calculates the nature interest rate. IRR, MIRR calculation period. NPER calculation payment. IPMT, PMT, PPMT calculates the current net value. NPV, PV

Keyword classification

Classification Description Array established, defined and use arrays. Compiling command control compilation mode. Control flow cycle and process flow control. Transform transform value and data type. Data Type Data Types and Variant Submatures. Date and time transformation, use date and time expressions. Directory and file control file system and processing files. Error detection and return error value. Finance conducts various financial computments. Entering and output accept input and display, printout. Mathematics completed various mathematical operations. Other activation other applications and processing events. Operators compare expressions and complete other operations. String processing processing strings and string data types. Variables and constant declarations define variables and constants.

Mathematical keyword summary

Role keyword triangle function. ATN, COS, SIN, TAN are generally calculated. EXP, LOG, SQR produces random number. Randomize, RND acquires an absolute value. ABS acquires the positive and negative numbers. SGN value transformation. FIX, int

Other keyword summary

Role keyword processing shelving event. Doevents run other programs. AppActiVate, Shell Send button information to other applications. SendKeys issued a warning. BEEP system. Environ provides command line string. Commandmacintosh. Macid, MacScript automatic. CreateObject, GetObject Color. Qbcolor, RGB operator keyword summary

Role keyword processing shelving event. Doevents run other programs. AppActiVate, Shell Send button information to other applications. SendKeys issued a warning. BEEP system. Environ provides command line string. Commandmacintosh. Macid, MacScript automatic. CreateObject, GetObject Color. Qbcolor, RGB

Registered keyword summary

Role keyword processing shelving event. Doevents run other programs. AppActiVate, Shell Send button information to other applications. SendKeys issued a warning. BEEP system. Environ provides command line string. Commandmacintosh. Macid, MacScript automatic. CreateObject, GetObject Color. Qbcolor, RGB

String processing keyword summary

Two strings are compared to the keyword. Strcomp transform strings. StrConv case transformation. Format, Lcase, UCase establishes a string of repeating characters. Space, String calculates the length of the string. LEN Sets the string format. Format rearrange string. LSET, RSET handles strings. Instr, LEFT, LTRIM, MID, RIGHT, RTRIM, TRIM Set string comparison rules. Option Compare uses ASCII and ANSI values. ASC, CHR

Variables and constant keyword summary

Role keyword specified. Let declare the variable or constant. Const, DIM, Private, Public, New, Static Declaration Module is private. Option private module judges Variant. Isarray, IsDate, ISempty, ISError, Ismissing, ISNULL, ISNUMERIC, ISOBJECT, TYPENAME, VARTYPE reference current objects. The ME variable must be clearly declared. Option Explicit Sets the default data type. DEFTYPE

AS

The AS key is used for the following statement:

Const statement

DECLARE statement

DIM statement

FUNCTION statement

Name statement

Open statement

PRIVATE statement

Property get statement

Property Let statement

Property SET statement

PUBLIC statement

Redim statement

STATIC statement

SUB statement

TYPE statement

Binary

Binary keyword is used for the following statement:

Open statement

OPTION COMPARE statement

Byref

BYREF keyword is used for the following statement:

Call statement

DECLARE statement

FUNCTION statement

Property get statement

Property Let statement

Property SET statement

SUB statement

BYVAL

BYVAL keyword is used for the following statement:

Call statement

DECLARE statement

FUNCTION statement

Property get statement

Property Let statement

Property SET statement

SUB statement

Date

Date Key For the following context:

Date data type

Date function

Date statement

Else

Else Keywords are used for the following statements:

If ... then ... ELSE statement

SELECT CASE statement

EMPTY

The EMPTY keyword is used as a Variant subtype. It represents an unmelted variable value.

Error

Error keyword is used in the following context:

Error function

Error statement

ON Error statement

False

The value of the FALSE key is equal to 0.

For

For keyword is used in the following context:

For ... NEXT statement

For Each ... Next statement

Open statement

Friend

Modify a definition of a process in the form module or class module so that the process can be called by modules outside the class, but must be within the part of the project defined. The Friend process cannot be used in the standard module.

grammar

[Private | Friend | Public] [Static] [SUB | FUNCTION | Property] ProcedureName

The required procedurename is the name of the process you want to set to be visible throughout the project, but the process is invisible for the controller of the class.

Description

The PUBLIC process in the class can be called anywhere, even if it is called by the controller of the class instance. Declare a process to prevent the controller of the object for the call for the process, but it also prevents the call to define the internal interior of the class to the process. Friend makes the process throughout the project, but the controller for an object instance is invisible. Friend can only appear in the form module and class module, and can only modify the name of the process, and the variables or types cannot be modified. A process in a class can access all other classes of a project. The Friend process does not appear in the class library. A Friend process cannot be bound by later periods.

Get

Get keyword is used in the following context:

Get statement

Property get statement

INPUT

Input keyword is used in the following context:

INPUT function

INPUT # statement

LINE INPUT # statement

Open statement

IS

IS keyword is used in the following context:

If ... then ... ELSE statement

IS operator

SELECT CASE statement

Len

Len keyword is used in the following context:

Len function

Open statement

Lethar

Let keywords are used in the following context:

Let statement

Property Let statement

LOCK

Lock Key For the following context:

LOCK, UNLOCK statement

Open statement

ME

The ME keyword is a variable that implies the declaration. This keyword is suitable for each process in the class module. When a class has multiple instances, the ME provides a method of reference a specific example in the area being executed. To pass the information about the current execution class instance to another module, ME is very useful. For example, it is assumed that there is the following process in the module:

SUB ChangeformColor (FormName as Form)

FormName.backcolor = RGB (RND * 256, RND * 256, RND * 256)

End Sub

This process can be called and the current instance of the form class will be passed as a parameter using the following statement.

ChangeformColor ME

MID

MID keyword is used in the following context:

MID function

MID statement

New

New keyword is used in the following context:

DIM statement

PRIVATE statement

PUBLIC statement

SET statement

STATIC statement

NEXT

Next Keywords are used in the following context:

For ... NEXT statement

For Each ... Next statement

ON Error statement

Resume statement

Nothing

Use the Nothing keyword to be separated from the actual object from the actual object. To use the SET statement to assign the Nothing to the object variable. E.g:

Set myObject = Nothing

Several object variables can reference the same actual object. This variable no longer references any actual object when Nothing is assigned to an object variable. When several object variables reference the same object, only the memory resources and system resources associated with the referenced objects will be released, here, or explicitly use SET, or Use the set after the last one is set to Nothing object variables. Nullnull keywords are used as a Variant subtype. It indicates that the variable does not contain valid data.

On

The ON key is used in the following context:

ON Error statement

ON ... GOSUB statement

On ... goto statement

Option

Option keyword is used in the following context:

OPTION BASE statement

OPTION COMPARE statement

OPTION EXPLICIT statement

Option private statement

Optional

Optional keyword is used in the following context:

DECLARE statement

FUNCTION statement

Property get statement

Property Let statement

Property SET statement

SUB statement

Paramarray

Paramarray keyword is used in the following context:

DECLARE statement

FUNCTION statement

SUB statement

Print

Print keyword is used in the following context:

PRINT method

PRINT # statement

Private

Private keyword is used in the following context:

Const statement

DECLARE statement

ENUM statement

FUNCTION statement

Option private statement

PRIVATE statement

Property get statement

Property Let statement

Property SET statement

SUB statement

TYPE statement

Property

Property keyword is used in the following context:

Property get statement

Property Let statement

Property SET statement

Public

Public keyword is used in the following context:

Const statement

DECLARE statement

ENUM statement

EVENT statement

FUNCTION statement

Property get statement

Property Let statement

Property SET statement

PUBLIC statement

SUB statement

TYPE statement

Resume

Resume keyword is used in the following context:

ON Error statement

Resume statement

Seek

SEEK keyword is used in the following context:

SEEK function

SEEK statement

Set

SET keyword is used in the following context:

SET statement

Property SET statement

Static

Static keyword is used in the following context:

FUNCTION statement

Property get statement

Property Let statement

Property SET statement

STATIC statement

SUB statement

STEP

STEP keyword is used in the following context:

For ... NEXT statement

For Each ... Next statement

String

String Key For the following context:

String data type

String function

THEN

The key is used in the following context:

#If ... Then ... # else command

If ... then ... ELSE statement

Time

Time keyword is used in the following context:

Time function

TIME statement

TO

TO keyword is used in the following context:

DIM statement

For ... NEXT statement

LOCK, UNLOCK statement

PRIVATE statement

PUBLIC statement

Redim statement

SELECT CASE statement

STATIC statement

TYPE statement

True

The value of the TRUE key is equal to -1.

Withevents

WitHevents keyword is used in the following context:

DIM statement

PRIVATE statement

PUBLIC statement

Add method

Add a member to the Collection object.

grammar

Object.add item, key, before, after

The syntax of the Add method has the following object qualifiers and naming parameters:

Partially describes Object necessary. Object expression, its value is an object in the "application" list. Item is required. Any type of expression specifies that the member to be added to the collection. Key is optional. The unique string expression, specify the key string that can be used, instead of the location index to access members in the collection. Before is optional. Expression, specify the relative position in the collection. Place the added member before the set member is previously identified. If a numerical expression, the Before must be a value between 1 and a collection count property value. If a string expression, the Before must correspond to the specified Key value when adding a referenced member to the collection. You can specify a Before location or an AFTER position, but you cannot specify both locations at the same time. After is optional. Expression, specify the relative position in the collection. After placing the added members in the collection after the After parameter identification. If it is a numeric expression, the AFTER must be a value between 1 and a set count attribute value; if a string expression is added, the AFTER must correspond to the specified time when adding a referenced member to the collection. Key value. You can specify a Before location or an AFTER position, but you cannot specify both locations at the same time.

Description

Before or after parameters are string expressions or numerical expressions, they must reference existing members in the collection, otherwise the error will occur.

If the KEY of the specified key is repeated if the KEY of the current member is repeated, the error will occur.

Add method (Dictionary)

description

Add a pair of corresponding keywords and entries to the Dictionary object.

grammar

Object.add Key, Item

The syntax of the Add method has the following parts:

Partially describes Object necessary. A name of a Dictionary object. Key must be. Key words associated with the added entry. Item is required. Entries associated with the added keywords.

Description

If the keyword already exists, an error is generated.

Add method (Folder)

description

Add a new Folder to the folders collection.

grammar

Object.addfolders foldername

The syntax of the AddFolders method is as follows:

Partially describes Object necessary. A Folders collection name. Foldername must be required. The name of the newly added Folder.

Description

If the FolderName already exists, an error is generated.

Assert method

Conditionally hangs execution in the line that appears in this method.

grammar

Object.Assert BooleaneXpression

The syntax of the ASSERT method has the following object definitions and parameters:

Partially describes Object necessary. Always debug objects. BooleaneXpression is required. A value of TRUE or FALSE.

Description

Assert calls only work in the development environment. When the module is compiled into an executable file, the method of calling the DEBUG object is ignored.

All BooleaneXpression is often calculated. For example, even if the first portion of an AND expression is calculated as FALSE, the entire expression is also calculated.

Buildpath method

description

Add a name to a path already existing. grammar

Object.buildpath (Path, Name)

The BUILDPATH method syntax has the following sections:

Partially describes Object necessary. Always the name of FileSystemObject. Path must be. The existing path to which the name is added. The path can be absolute or relative, does not have to specify an existing folder. Name must be. To append the name on the existing path.

Description

Only when needed, the BuildPath method is inserted between an additional path separator between the existing path and the name.

Clear method

Clear all attribute settings for ERR objects.

grammar

Object.clear

Object is always an ERR object.

Description

Use clear to clear the ERR object after processing errors, for example, Clear can be used when handling the ON Error Resume Next. Clear method whenever the following statement is performed:

Any type of RESUME statement. EXIT SUB, EXIT FUNCTION, EXIT Property Any ON Error statement.

Note When processing an error generated by access to other objects, uses ON Error Goto, it is better to use the ON Error Resume next. Check ERR each time you deal with the object, you can eliminate the inclusion of the code access object. It can be confirmed that which object will be incorrect into err.Number, or you can confirm which object originally generated this error (the object specified in Err.Source).

Close method

description

Close an open textstream file.

grammar

Object.close

Object is always the name of a TextStream object.

COPY method

description

Copy a specified file or folder from one place to another.

grammar

Object.copy destination [, OVERWRITE]

Copy method syntax has the following sections:

Partially describes Object necessary. Always a name of a FILE or FOLDER object. Destination must be. Document or folder If you copy the acceptable end. There is no wildcard. OverWrite is optional. Boolean value, if this value is true (default), the existing file or folder will be overwritten. If false, they are not overwritten.

Description

The result of a File or Folder, a copy method and the implementation of FileSystemObject.copyfile or FileSystemObject.copyFolder operation is the same. In the latter, the file or folder referenced by Object is passed as parameters. It should be noted that the following methods can copy multiple files or folders.

CopyFile method

description

Copy one or more files from one place to another.

grammar

Object.copyFile Source, Destination [, OVERWRITE]

CopyFile method syntax has the following sections:

Partially describes Object necessary. Object is always the name of a FileSystemObject. Source must be required. Indicates a string file instructions for one or more copies to be replicated, which can include wildcards. Destination must be. Indicates one or more files in the source to be copied to the receiving end string, and there is no wildcard. Overwrite options. The Boolean value indicates whether the existing file is overwritten. If true, the file will be overwritten; if it is false, they are not overwritten. The default is True. Note If the Destination has read-only properties settings, copyfile will fail regardless of the overwrite value. Description

Wildcards can only use the last path part of the Source parameter. For example, you can use wildcards below:

FileSystemObject.copyfile "c: / mydocuments / letters / *. Doc", "c: / tempfolder /"

But the following conditions cannot be used:

FileSystemObject.copyFile "C: / myDocuments / * / R1 ??? 97.xls", "c: / tempfolder"

If the source contains the wildcard or Destination with the path separator (/), it is considered that Destination is an existing folder where the matching file is copied. Otherwise, Destination is a name to create a file. Whether it is the case, three events may occur when copying a file.

If Destination does not exist, SOURCE gets replication. This is usually the case. If Destination is an existing file, an error occurs when the OverWrite value is false, otherwise, Source's replication file will attempt to override the existing file. If Destination is a directory, an error occurs.

If you use wildcard sources that cannot match any files, you also generate an error. The CopyFile method stops on the first error it encountered. Do not try to return to any changes you made before the error occurred.

CopyFolder method

description

Copy a folder from one place to another place.

grammar

Object.copyfolder Source, Destination [, OVERWRITE]

Copyfolder method syntax has the following sections:

Partially describes Object necessary. Always the name of a FILESystemObject. Source must be required. Indicates a string folder for one or more replicated folders, which can include wildcards. Destination must be. Specifies the string of the receiving folder and subfolder in the Source, which is not allowed to have wildcards. Overwrite options. The Boolean value indicates whether the existing folder is overwritten. If true, the file is overwritten. If false, the file is not overwritten. The default is TRUE.

Description

Wildcards can only be used for the last path part of the Source parameter. For example, you can use it below:

FileSystemObject.copyfolder "c: / mydocuments / letters / *", "c: / tempfolder /"

But you can't use it below:

FileSystemObject.copyfolder "c: / myDocuments / * / *", "c: / tempfolder /"

If Source contains wildcard or Destination, the path separator (/) is ending, it is considered that Destination is an existing folder where copying the matching folder and subfolders. Otherwise, Destination is a name of the folder to create. Regardless of the situation, four events may occur when copying a folder. If Destination does not exist, the Source folder and all its content are copied. This is usually the case. If Destination is an existing file, an error occurs. If Destination is a directory, it will try to copy the folder and all its content. If a file containing Source is already in Destination, an error occurs when OverWrite is false, otherwise it will try to overwrite this file. If Destination is a read-only directory, an error occurs when trying to copy an existing read-only file to this directory and overwrite is false.

An error occurs if the wildcards used by SOURCE cannot match any folder.

The CopyFolder method stops on the first error it encountered. Don't try any changes you made before the error occurred.

CreateFolder method

description

Create a folder.

grammar

Object.createfolder (Foldername)

The CreateFolder method has the following sections:

Partially describes Object necessary. Always a name of FileSystemObject. Foldername must be required. String expressions, it identifies the created folder.

Description

An error occurs if the specified folder already exists.

CreateTextFile method

description

Create a specified file name and return a TextStream object for that file read or written.

grammar

Object.createtextfile (filename [, overwrite [, uncode]])

The CreateTextFile method has the following sections:

Partially describes Object necessary. Always a FileSystemObject or the name of the folder object. FileName must be required. String expressions, it identifies the created file. OverWrite is optional. The Boolean value indicates whether an existing file can be overwritten. If the value can be overridden, it cannot be overwritten when the value is false. If it is omitted, there is an existing file that cannot be overwritten. Unicode is optional. The Boolean value indicates that the file is created as a Unicode file or is created as an ASCII file. If you are created as a Unicode file, it is true, as an ASCII file, its value is false. If you omit, it is considered an ASCII file.

Description

The following code example shows how to create and open a text file using the CreateTextFile method.

Sub Createafile

Set fs = creteObject ("scripting.filesystemobject")

Set a = fs.createtextfile ("c: /testfile.txt", true)

a.writeline ("this is a test.")

a.close

End Sub

For an existing filename, an error occurs if the OverWrite parameter is false or not provided.

Delete method

description

Delete a specified file or folder.

grammar

Object.delete Force

The DELETE method syntax has the following sections: section describes Object necessary. Always a name of a FILE or FOLDER object. Force is optional. Boolean value, if you want to delete a file or folder with read-only properties, its value is true. When its value is false (default), a file or folder with read-only attribute setting cannot be removed.

Description

An error occurs if the specified file or folder does not exist.

For a result of a File or Folder, the result of the DELETE method and the result of the FileSystemObject.deletefile or FileSystemObject.deleteFolder operation is the same.

The delete method does not distinguish between the contents of the folder. It is deleted regardless of whether the designated folder has content.

Deletefile method

description

Delete a specified file.

grammar

Object.deletefile filespec [, force]

DELETEFILE method syntax has the following sections:

Partially describes Object necessary. Always a name of FileSystemObject. FileSpec must be required. To delete the name of the file. FileSpec can include wildcard characters in the final path part. Force is optional. Boolean value, if you want to delete files with read-only properties, its value is true. If its value is false (default), you cannot delete a file with read-only properties.

Description

If no matching file is found, an error is generated. The deletefile method stops on the first error it encounter. Do not try back any changes you made before the error occurred.

DeleteFolder method

description

Delete a specified folder and its content.

grammar

Object.deletefolder folderspec [, force]

The deletefolder method has the following sections:

Partially describes Object necessary. Always a name of FileSystemObject. Folderspec must be required. The name of the folder to be deleted. Folderspec can include wildcard characters in the final path part. Force is optional. Boolean value, if you want to delete a folder with read-only property settings, its value is true, if the value is false (default), the folder with read-only property setting cannot be deleted.

Description

The DeleteFolder method does nothing else in the folder. Regardless of whether there is content in the specified folder, it is deleted.

If you do not find a matching folder, an error occurs. The deletefolder method stops on the first error it encounter, do not try back any changes before the error occurred before the error occurs.

Driveexists method

description

Returns true if the specified drive exists, if there is no false.

grammar

Object.driveexists (Drivespec)

DriveExists method syntax has the following sections:

Partially describes Object necessary. Always a name of FileSystemObject. Drivespec is required. A drive character or a complete path description.

Description

For drivers that can delete media, even if there is no medium exist, the DriveExists method also returns TRUE. Using the IsReady property of the Drive object determines if the drive is ready.

EXISTS method

description

Returns true if the keyword specified in the Dictionary object is returned, if there is no existence, return false.

grammar

Object.exists (key)

The exists method has the following sections:

Partially describes Object necessary. Always a name of a Dictionary object. Key must be. The Key value searched in the Dictionary object. FileExists method

description

If the specified file exists, return TRUE, if there is no existence, return false.

grammar

Object.fileexists (filespec)

FileExists method syntax has the following sections:

Partially describes Object necessary. Always a name of FileSystemObject. FileSpec must be required. To determine if the name of the file exists. If the file is not in the current folder, a complete path description must be provided (absolute or relative).

FolderExists method

description

If the specified folder exists returns True, there is no false to return.

grammar

Object.foldeRexists (Folderspec)

FolderExists method syntax has the following sections:

Partially describes Object necessary. Always a name of a FileSystemObject object. Folderspec must be required. To determine if the folder name existing. If you think that the folder is not in the current folder, you must provide a complete path description (absolute or relative).

GetabsolutePathname method

description

Returns a complete, clear path from the supplied path description.

grammar

Object.getabsolutePathname (PathSpec)

GetabsolutePathname Method Syntax has the following sections:

Partially describes Object necessary. Always a name of FileSystemObject. PathSpec must be. To change to a complete, clarified path of the path.

Description

A path If a complete reference from the specified drive root directory is provided, the path is complete and clear. A complete path If you specify a root folder of the mapping drive, it can only end with the path separator (/).

Suppose the current directory is C: / MyDocuments / Reports, the following table illustrates the behavior of the GetAbsolutePathname method.

PathSpec Returned Path "C:" "C: / MyDocuments / Reports" "C:" C: / MyDocuments "" C: /// "" C: / "" C: *. * / May97 "" C: / myDocuments / reports /*.*/ May97 "" Region1 "" C: / myDocuments / reports / region1 "" c: /../../ mydocuments "" c: / mydocuments "

GetBaseName method

description

Returns a string of basic names (remove any file extensions) containing the last part of the path.

grammar

Object.getBaseName (PATH)

GetBaseName method syntax has the following sections:

Partially describes Object necessary. Always a name of FileSystemObject. Path must be. To return to the path of the part of its basic name.

Description

If there is no component and Path parameter matching, the getBaseName method returns a string ("") of length zero.

Note that the getBaseName method only works in string of the supplied PATH. It does not attempt to identify the path and do not check if the specified path is present.

GetDrive method

description

Returns a Drive object corresponding to the drive in the specified path.

grammar

Object.getdrive Drivespec

The GetDrive method syntax has the following sections: Partially describe Object required. Always a name of FileSystemObject. Drivespec is required. The DRIVESPEC parameter can be a drive character (C), a drive character plus a colon (C :), a drive character plus a colon and a path separator (C: /) or any network sharing (// computer2 / share1).

Description

For network sharing, check to make sure the shared existence.

An error occurs if DRIVESPEC does not meet any of the acceptable forms or does not exist.

Call the GetDrive method for a normal path string, use the following steps to get a string suitable as DRIVESPEC:

Drivespec = getDriveName (GetabsolutePathname (PATH))

GetDriveName method

description

Returns a string of the drive name containing the specified path.

grammar

Object.getdriveName (PATH)

GetDriveName method syntax has the following sections:

Partially describes Object necessary. Always a name of FileSystemObject. Path must be. To return to the path of the part of its drive name.

Description

If the drive cannot be determined, the getDriveName method returns a string ("") of length zero.

Note that the getDriveName method functions only for the supplied path string. It does not attempt to identify the path, nor does it check for the specified path.

GetExtensionName method

description

Returns a string containing the last part extension in the path.

grammar

Object.getextensionName (PATH)

GetExtensionName method syntax has the following sections:

Partially describes Object necessary. Always a name of FileSystemObject. Path must be. To return to the path of the part of its extension.

Description

For the network drive, the root directory (/) is considered to be a component.

If there is no component and PATH parameters match, the getExtensionName method returns a string ("") of length zero.

Getfile method

description

Returns a File object corresponding to the file in the specified path. .

grammar

Object.getfile (filespec)

Getfile method syntax has the following sections:

Partially describes Object necessary. Always a name of FileSystemObject. FileSpec must be required. FILESPEC is a path to a specified file (absolute or relative).

Description

If the specified file does not exist, an error occurs.

GetFileName method

description

Returns the last part in the specified path, which is not part of the drive description.

grammar

Object.getFileName (PathSpec)

GetFileName method syntax has the following sections:

Partially describes Object necessary. Always a name of FileSystemObject. PathSpec must be. Go to a path to a specified file (absolute or relative).

Description

If PathSpec is not ending with the named component, the getFileName method returns a zero-length string ("").

Note that the getFileName method works only on the supplied path strings. It does not attempt to identify the path, nor does it check for the specified path.

GetFolder method

description

Returns a Folder object corresponding to the inverter in the specified path.

grammar

Object.getFolder (Folderspec) GetFolder method syntax has the following sections:

Partially describes Object necessary. Always a name of FileSystemObject. Folderspec must be required. Folderspec is the path to the specified folder (absolutely and relative).

Description

An error occurs if the specified folder does not exist.

GetParentFoldername method

description

Returns a string containing the name of the parent folder name of the specified path.

grammar

Object.getParentFoldername (PATH)

GetParentFoldername Method Syntax has the following sections:

Partially describes Object necessary. Always a name of FileSystemObject. Path must be. To return to the path of the part of its parent folder name.

Description

If the part specified by the PATH parameter does not have a parent folder, the getParentFoldername method returns a zero-length string ("").

Note that the getParentFoldername method works only for the supplied Path string. It does not attempt to identify the path, nor does it check for the specified path.

GetSpecialFolder method

description

Returns the specified special folder.

grammar

Object.getspecialFolder (Folderspec)

The GetSpecialFolder method syntax has the following sections:

Partially describes Object necessary. Always a name of FileSystemObject. Folderspec must be required. The name of the special folder to return. Can be any constant listed in the set value section.

Settings

The Folderspec parameter can be any of the following values:

The constant value describes the WindowsFolder0Windows folder, which contains files installed by the Windows operating system. SystemFolder1 system folder, contains libraries, fonts, and device drivers. TempoRyFolder2Temp folder for storing temporary files. Its path is in the TMP environment variable.

GetTempName method

description

Returns a randomly generated temporary file or folder name, which is useful when performing operations that require temporary files or folders.

grammar

Object.getTempname

Optional Object is always a name of FileSystemObject.

Description

The GetTempName method does not generate a file, which only provides a temporary file name, which can be used by CreateTextFile to create a file.

ITEM method

Use the location or key to return to the specified member of the Collection object.

grammar

Object.Item (Index)

The syntax of the ITEM method has the following object limits and part:

Partially describes the object of Object. Object expressions, its value is "applying to" objects in the list. INDEX is necessary. For an expression, specify the position of the members in the collection. If it is a numeric expression, INDEX must be a value between 1 to the set count property value. If it is a string expression, INDEX must correspond to the Key parameter when an additional member is added to the collection.

Description

If the index value does not match any existing member of the collection, it will cause errors.

The ITEM method is a collection of default methods. Therefore, the following two line program is equivalent:

Print MyCollection (1)

Print mycollection.Item (1)

Items method

description

Returns an array containing all entries in the Dictionary object.

grammar

Object.Items

Object is always the name of a Dictionary object.

Description

The following code illustrates the use of the Items method. :

DIM A, D, I 'Create some variables set d = createObject ("scripting.dictionary")

D. ADD "A", "athens" 'adds some keywords and entries.

D.ADD "B", "belgrade"

D.ADD "C", "cairo"

A = D.Items' gets an entry

For i = 0 to d.count -1 'repeated array

Print A (i) 'printing entries

NEXT

...

Keys method

description

Returns an array that contains all existing keywords in a Dictionary object.

grammar

Object.keys

Object is always the name of a Dictionary object.

Description

The following code illustrates the use of the Keys method.

DIM A, D, I 'Create some variables

SET D = CreateObject ("scripting.dictionary")

D. ADD "A", "athens" 'adds some keywords and entries.

D.ADD "B", "belgrade"

D.ADD "C", "cairo"

A = d.keys' acquisition keyword

For i = 0 to d.count -1 'repeated array

Print A (i) 'printing keyword

NEXT

...

MOVE method

description

Move a specified file or folder from one place to another.

grammar

Object.move destination

Move method syntax has the following sections:

Partially describes Object necessary. Always a name of a FILE or FOLDER object. Destination must be. Documents or folders to move to the target. There is no wildcard.

Description

The Move method is the same as the result of a FILE or FOLDER and the result of the FileSystemObject.movefile or FileSystemObject.moveFolder operation. However, it should be noted that the following methods can move multiple files or folders.

Movefile method

description

Move one or more files from one place to another.

grammar

Object.movefile Source, Destination

Movefile method syntax has the following sections:

Partially describes Object necessary. Always a name of FileSystemObject. Source must be required. One or more paths to move files. The Source parameter string can only contain wildcards in the last part of the path. Destination must be. One or more files to be moved to the target path. Destination parameters cannot contain wildcards.

Description

If the source contains the wildcard or Destination with the path separator (/), it is considered that the Destination specifies a presented folder that moves the match in this folder. Otherwise, it is considered that Destination is a target file name to be created. In any case, three events may occur when moving a file.

If Destination does not exist, the file is moved. This is usually the case. If Destination is an existing file, an error occurs. If Destination is a directory, an error occurs.

An error also occurs if a wildcard used in Source cannot match any file. The MoveFile method stops on the first error it encountered. Don't try any changes you made before the error occurred. This method allows you to move files between volumes only in the case of operating system support.

Movefolder method

description

Move one or more folders from one place to another.

grammar

Object.movefolder Source, Destination

The MOVEFolder method syntax has the following sections:

Partially describes Object necessary. Always a name of FileSystemObject. Source must be required. One or more folder paths to move. The Source parameter string can only contain wildcards in the last part of the path. Destination must be. One or more folders you want to move to the target path. Destination parameters cannot contain wildcards.

Description

If the source contains the wildcard or Destination with the path separator (/), it is considered that the Destination specifies an existing folder that moves the match in this folder. Otherwise, it is considered that Destination is a target folder name to be created. In any case above, three situations may occur when a folder is moved.

If Destination does not exist, the folder is moved. This is usually the case. If Destination is an existing file, an error occurs. If Destination is a directory, an error occurs.

An error occurs if a wildcard used in Source does not match any folder. The MoveFolder method stops on the first error it encountered. Don't try back any changes you made before the error occurred.

The focus only allows the folder to move between the volumes only in the case of operating system support.

OpenastextStream method

description

Open a specified file and return a TextStream object, which can be used to read, write, and add an action on the file.

grammar

Object.openastextStream ([Iomode, [Format]])

OpenastextStream method syntax has the following sections:

Partially describes Object necessary. Always a name of a File object. Iomode is optional. Indicates the input / output method. Can be one of three constants: Forreading, ForWriting or FORAPPENDING. Format is optional. One of the three Tristate values ​​for indicating the format of the open file. If omitted, the file opens in ASCII format.

Settings

The iomode parameter can be any value in the set value of the following:

Constant value description forreading1 Opens a read-only file and cannot write this file. ForWriting2 opens a file for writing. If the file with this file is already existing, the previous content is overwritten. FORAPPENDING8 opens a file and writes the end of the file.

The Format parameter can be any value in the set value of the following:

Constant Value Description TristateUsesedefault-2 Opens the file using the system default. TristateTrue-1 Opens file in Unicode format. Tristatefalse0 opens files in ASCII format.

Description

The OpenASTextStream method provides the same functionality as the OpenTextFile method of FileSystemObject. In addition, the OpenASTextStream method can also be used to write a file.

The following code illustrates the use of the OpenASTextStream method:

Sub TextStreamtest

Const forreading = 1, forWriting = 2, FORAPPPpending = 3const TristateuseDefault = -2, tristatetrue = -1,

Tristatefalse = 0

DIM FS, F, TS, S

Set fs = creteObject ("scripting.filesystemobject")

fs.createTextFile "Test1.txt" "Creates a file

Set f = fs.getfile ("test1.txt")

SET TS = f.OpenastextStream (ForWriting, TristateuseDefault)

Ts.Write "Hello World"

Ts.close

Set Ts = f.OpenastextStream (Forreading, TristateuseDefault)

s = ts.readline

Msgbox S

Ts.close

End Sub

OpenTextFile method

description

Open a specified file and return a TextStream object, which can be used to read or add an action on the file.

grammar

Object.opentextfile (filename [, omode [, create [, format]]])

The OpenTextFile method has the following sections:

Partially describes Object necessary. Always a name of FileSystemObject. FileName must be required. String expressions, it identifies the open file. Iomode is optional. Indicates the input / output mode. Can be one of two constants: Forreading or FORAPPENDING. CREATE is optional. Boolean value, it means if the specified filename does not exist if you can create a new file. If you create a new file, its value is True. If you do not create a file, its value is false. The default is false. Format is optional. One of three Tristate values, used to indicate the format of the open file. If omitted, the file opens in ASCII format.

Settings

The Iomode parameter can be any of the settings of the following:

Constant value description forreading1 opens a read-only file. This file cannot be written. FORAPPENDING8 opens a file and writes the end of the file.

The format parameter can be any value for the following settings:

Constant Value Description TristateUsesedefault-2 Opens the file using the system default. TristateTrue-1 Opens file in Unicode format. Tristatefalse 0 Opens files in ASCII format.

Description

The following code illustrates the file using the OpenTextFile method to open a file used to add text:

Sub OpenTextFileTestSt

Const forreading = 1, forWriting = 2, FORAPPENDING = 3

DIM FS, F

Set fs = creteObject ("scripting.filesystemobject")

Set f = fs.opentextfile ("c: /testfile.txt", foreppending, tristatefalse

F.Write "Hello World!"

f.close

End Sub

PRINT method

Display text in the Immediate window.

grammar

Object.print [outputlist]

The syntax of the Print method has the following object definitions and part:

Partially describes Object necessary. Object expression, its value is an object in the "application" list. OutputList is optional. A list of expressions or expressions to print. If you omit, a blank line is printed. The OutputList parameter has the following grammar and part:

{SPC (N) | Tab (n)} Expression Charpos

Some describe SPC (N) optional. Used to insert a blank character in the output, where n is the number of blank characters to be inserted. Tab (n) is optional. Used to position the insertion point on the absolute number, here, n is the column number. Use the non-parametric Tab (n) to position the insertion point in the starting position of the next print area. Expression is optional. Value expression or string expression to be printed. Charpos is optional. Specifies the insertion point of the next character. Use the semicolon (;) directly to position the insertion point after the previously displayed character. Use Tab (n) to position the insertion point on the absolute number. Use the non-parametric Tab to position the insertion point in the starting position of the next print area. If Charpos is omitted, print the next character in the next line.

Description

Multiple expressions can be separated by blank or semicolons.

The country settings specified for the system are properly formatted with the decimal separator to properly format the data that print to the Immediate window. The keyword is used to output a language for the primary application.

For Boolean data, or print true or print FALSE. Translate True and false keywords based on the regional settings of the host application.

Write Date data using the standard short date format that can be identified. When the date or time component is lost or zero, only the part provided is written.

If the outputlist data is EMPTY, no content can be written. However, if the outputlist data is NULL, the NULL is output. When outputting a null keyword, you should translate the keyword correctly.

To output the error data as an Error ErrorCode. When outputting an Error keyword, you should translate the keyword correctly.

If this method is used outside of the module with default display space, Object is required. For example, if this method is called on the standard module without a specified object, the error will occur, but if the call is called on the form module, "OUTPUTLIST" will be displayed on the form.

Note Because the Print method is printed according to the character ratio, the number of characters is not related to the number of columns that are fixed by the character. For example, the width of a wide letter like "W" exceeds a fixed column width, and the width of narrow alphabets like "I" is smaller. Taking into account the space to be wider than the average character, there must be sufficient room for the table. Alternatively, fixed spacing fonts (like Courier fonts) can also be used to ensure that each character accounts for only one column.

Raise method

Generate runtime errors.

grammar

Object.raise Number, Source, Description, Helpfile, HelpContext

The RAISE method has the following object qualifiers and naming parameters:

Parameter Description Object is required. Always ERR object. Number is required. LONG integer, identifying error nature. Visual Basic Error (Errors defined by Visual Basic) ranges between 0-65535. The range from 0-512 is preserved as a system error; the range from 513-65535 can be used as a user-defined error. When the Number property is set to your own error code in the class module, the error code number can be added to the VBObjectError constant. For example, in order to generate error number 513, VBObjectError 513 can be assigned to Number attributes. Source is optional. String expressions, named incorrect objects or applications. When setting this property of an object, use the form project.class. If there is no Source specified, the programming ID of the current Visual Basic project is used. Description optional. Describe the wrong string expression. If not specified, check the value of Number. If the error is mapped to the Visual Basic runtime error code, the character string returned by the Error function is used as the Description. If there is no Visual Basic error corresponding to Number, you want to use a message "Error defined by the application or object definition". Helpfile is optional. The full qualified path for help files, you can find help information about the error in the help file. If there is no specified, Visual Basic uses the full qualified drive, path, and file name of the Visual Basic Help file. HelpContext is optional. Identify the context ID of the title within HelpFile, and HelpFile provides a description that helps to understand errors. If omitted, use the context ID of the Visual Basic Help file for the error, which corresponds to the Number property. Description

All parameters are optional except Number. If you use Raise without specifying some parameters, and the attribute setting of the ERR object sets the value that is unclear, it is regarded as the value of the error.

RAISE is used to generate runtime errors and can be used instead of an Error statement. When you write a class module, an error is generated, and Raise is useful because ERR objects may provide richer information than Error statements. For example, with a RAISE method, you can specify the source of generated an error in the Source property, you can reference the error online help.

Read method

description

Read the specified number of characters from a TextStream file and returns the resulting string.

grammar

Object.read (characters)

The read method syntax has the following sections:

Partially describes Object necessary. Always a name of a TextStream object. Characters is required. The number of characters to be read from the file.

Readall method

description

Read the entire TextStream file and return the resulting string.

grammar

Object.readall

Object is always the name of a TextStream object.

Description

For large files, use the Readall method to waste memory resources. You should use other techniques to enter a file, such as reading the file in a row.

READLINE method

description

Read a whole line from a TextStream file (to the commissioning but does not include a wrapper) and returns the resulting string.

grammar

Object.readline

The Object parameter is always the name of a TextStream object.

REMOVE method

Remove the member from the Collection object.

grammar

Object.remove Index

The syntax of the REMOVE method has the following object qualifiers and part: section describes Object necessary. Object expression, its value is an object in the "application" list. INDEX is required. Expression, specify the location of the collection member. If it is a numerical expression, INDEX must be the number between 1 and the collection count attribute value. If it is a string expression, INDEX must match the key parameter when adding a reference to a collection.

Description

If the value of Index does not match the existing member of the collection, the error will occur.

REMOVE method

description

Remove a keyword and entry pair from a Dictionary object.

grammar

Object.remove (Key)

Remove method syntax has the following sections:

Partially describes Object necessary. Always a name of a Dictionary object. Key must be. Key is associated with the keywords and entries you want to delete from the Dictionary object.

Description

An error occurs if the specified keyword and entry do not exist.

The following code illustrates the use of the Remove method:

DIM A, D, I 'Create some variables

SET D = CreateObject ("scripting.dictionary")

D.Add "a", "athens" 'Add some keywords and entries

D.ADD "B", "belgrade"

D.ADD "C", "cairo"

...

A = D.Remove () 'Delete the second pair

RemoveAll method

description

The RemoveAll method removes all keywords and entries from the Dictionary object.

grammar

Object.removeall

Object is always the name of a Dictionary object.

Description

The following code illustrates the usage of the RemoveAll method:

DIM A, D, I 'Create some variables

SET D = CreateObject ("scripting.dictionary")

D.Add "a", "athens" 'Add some keywords and entries

D.ADD "B", "belgrade"

D.ADD "C", "cairo"

...

A = D. Removeall 'Clear Dictionary

SKIP method

description

Skip the specified number of characters when reading a TextStream file.

grammar

Object.skip (characters)

Skip method syntax has the following sections:

Partially describes Object necessary. Always a name of a TextStream object. Characters is required. The number of characters to be skipped when reading the file.

Description

The skipped characters are abandoned.

Skipline method

description

Skip the next line when reading a TextStream file.

grammar

Object.skipline

Object is always the name of a TextStream object.

Description

Skip one line refers to reading and abandoning all characters in a row, and has arrived and included the row.

If the read file is not open, an error is generated.

Write method

description

Write a specified string to a TextStream file.

grammar

Object.write (string)

Write method syntax has the following sections:

Partially describes Object necessary. Always a name of a TextStream object. String must be. To write the body going to the file.

Description

The specified string is written to the file, and a space or character is not inserted between each string. Write a wrap or a string ending with a wrap. Writeblanklines method

description

Write the specified number of wraps into a TextStream file.

grammar

Object.writeblanklines (Lines)

Writeblanklines method syntax has the following sections:

Partially describes Object necessary. Always a name of a TextStream object. Lines must be. The number of wraps to be written.

WriteLine method

description

Write a specified string and a wrap in a TextStream file. .

grammar

Object.writeline ([string])

WriteLine method syntax has the following sections:

Partially describes Object necessary. Always a name of a TextStream object. String is optional. To write the body of the file. If omitted, a newline is written in a file.

Character set (0-127)

0? 32 [Space] 64 @ 96`1 · 33! 65A97A2 · 34 "66b98b3 · 35 # 67c99c4 · 36 $ 68D100D5 · 37% 69e101E6 · 38 & 70F102F7 · 39'71G103G8 * 41) 73i105i10 * * 42 * 74J106j11 · 43 75K107k12 · 44,76L108l13 * * 45-77M109m14 · 46.78N110n15 · 47 / 79O111o16 · 48080P112p17 · 49181Q113q18 · 50282R114r19 · 51383S115s20 · 52484T116t21 · 53585U117u22 · 54686V118v23 · 55787W119w24 · 56888X120x25 · 57989Y121y26 · 58: 90Z122z27 · 59; 91 [123 {28 · 60 <92/124 | 29 · 61 = 93] 125} 30 · 62> 94 ^ 126 ~ 31 · 63? 95_127 ·

* · Microsoft Windows. These characters are not supported.

* * * Value 8, 9, 10 and 13 are converted to back, tab, wrap, and carriage return characters, respectively. They don't have a specific graphic display, but will have different influences on text display according to different applications.

Character set (128-255)

128 · 160 [SPACE] 192à224à129 · 161? 193á225á130 · 162 ¢ 194? 226A131 · 163 £ 195? 227? 132 · 164 ¤196? 228? 133 · 165 ¥ 197? 229? 134 · 166 | 198? 230? 135 · 167 §199? 231? 136 · 168 ¨200è232è137 · 169 © 201 é233 é138 · 170A202ê234ê139 · 171? 203? 235? 140 · 172? 204ì236ì141 · 173-205í237í142 · 175®206? 238? 144 · 176 ° 208D240E145D2409? 241? 146'1782210ò242ò147 · 1793211ó243ó148 · 180'212? 244? 149, 181μ213? 245? 150 · 182? 214? 246? 151 · 183 · 215 × 247 ÷ 152 · 184? 216? 248? 153 · 1851217ù249ù154 · 186o218ú250ú155 · 187? 219? 251? 156 · 188? 220ü252ü157 · 189? 221Y253Y158 · 190? 222254T159 · 191? 223? 255?

· Microsoft Windows does not support these characters.

The value in this table is the default value of Windows. The value of the ANSI feature set 127 or more is determined by the code page related to the operating system.

Documentation

The Visual Basic documentation follows the following arrangements:

Specific instructions Sub, if, chdir, print, true, Debug first letters, bold characters represent language-specific keywords. The setup operation command is represented by a bold. Object, Varname, Arglist's lowercase letters indicate the information you have to provide. Pathname, Filenumber's lowercase letters indicate parameters, where you can specify or name a parameter syntax using its location. [ExpressionList] In the syntax, the project representatives in parentheses are optional. {While | Until} In the syntax, indicating that you can select one from the project in parentheses. And you must choose one unless there is a bracket, for example: [{this | orth}] ESC, ENTER small uppercase letters represent the key name and button order. Alt F1, Ctrl R Represents a combination key name with a plus sign ( ) connection button, for example, Alt F1 means pressing the Alt key, then press F1. Code agreement

Use the following code to agree:

Code example shows mYString = "Hello, World!" This font is used for code, variables and error messages. 'This is a comment. Symbol (') Boots the comment text. MYVAR = "this is an" _ & "example" _ & "of how to payue code." Blank Underline (_) can continue two lines of code.

COLLECTION object

The Collection object is an ordered collection of projects that can be referenced to units.

Description

The Collection object provides a simplicity method that is straightforward to reference a set of related items as a single object. Projects or members in the collection are linked to this fact: they all belong to this collection. Members of the collection are not necessarily the same data type.

Establish a collection method as the method of establishing other objects. E.g:

DIM X As New Collection

Once the collection is established, you can add a member with the Add method to remove members with the Remove method. When repeating the entire collection with the for Each ... Next statement, you can use the Item method to return a specific member from the collection.

Debug object

Debug objects send the output to the output to

Immediate window.

Dictionary object

description

Objects are used to store data keywords and entries.

grammar

Scripting.dictionary

Description

Dictionary object is equivalent to the Perl associated array. It can be an entry of any form of data being stored in an array. Each entry is associated with a unique keyword. This keyword is used to retrieve a single entry, usually an integer or string, which can be any type outside of the division group.

The following code illustrates how to create a Dictionary object:

DIM D 'creates a variable

SET D = CreateObject (scripting.dictionary)

D.Add "a", "athens" 'Add some keywords and entries

D.ADD "B", "belgrade"

D.ADD "C", "cairo"

...

Drive object

description

Access is provided for properties for specific disk drives or network sharing.

Description

The following code illustrates that using the Drive object to access the drive properties:

Sub ShowFreespace (drvpath)

DIM FS, D, S

Set fs = creteObject ("scripting.filesystemobject")

Set d = fs.getdrive (fs.getdrivename (drive ") s =" drive "& ucase (drvpath) &" - ​​"

S = S & D.VoluMename & VBCRLF

s = S & "Free Space:" & FormatNumber (D.Freespace / 1024, 0)

S = S & "Kbytes"

Msgbox S

End Sub

DRIVES collection

description

Read only a collection of available drives.

Description

For delete drives, it is not necessary to insert the media into it, it can be displayed in the DRIVES collection.

The following code illustrates how to get the DRIVES collection, and how to use the for Each ... Next statement to access each Drive in the collection:

Sub showdriveList

DIM FS, D, DC, S, N

Set fs = creteObject ("scripting.filesystemobject")

SET DC = fs.drives

For Each D in DC

S = S & D.Driveletter & "-"

IF D.DriveType = Remote Then

n = d.ShareName

Else

n = d.volumename

END IF

S = S & N & VBCRLF

NEXT

Msgbox S

End Sub

Err object

Contains information about runtime errors.

Description

The attribute of the ERR object is set by the generator of the error, this generator or Visual Basic, or an object, or a programmer.

The default attribute of ERR object is Number. Because the default attribute can be represented by the object name ERR, there is no need to modify the code written by ERR functions or ERR statements before.

When the runtime error occurs, the attribute of the ERR object is filled in the information that explicitly identifies the error and the information used to handle this error. In order to generate runtime errors in your code, use the RAISE method.

After any form of RESUME or ON ERROR statement and after the EXIT SUB, EXIT FUNCTION, or the EXIT Property statement within the subroutine, the attribute of the ERR object is reset to zero or length is zero ("") . You can use the Clear method to re-explicitly set the ERR.

In order to generate runtime errors for system errors and class modules, use the RAISE method without using an Error statement. Do you use a Raise method in other code, you have to see how much the information you want to return.

ERR object is an inherent object with a global range. There is no need to establish an instance of these objects in your code.

File object

description

Provide access to all properties of the file.

Description

The following code illustrates how to get a File object and how to view an attribute.

Sub showfileinfo (filespec)

DIM FS, F, S

Set fs = creteObject ("scripting.filesystemobject")

Set f = fs.getfile (filespec)

s = f.datecreated

Msgbox S

End Sub

Files collection

description

Collection of all File objects in a folder.

Description

The following code illustrates how to get a Files collection, and how to use for Each ... next statement to access each file in this collection: Sub ShowFolderList (Folderspec)

DIM FS, F, F1, FC, S

Set fs = creteObject ("scripting.filesystemobject")

Set f = fs.getFolder (Folderspec)

Set fc = f.files

For Each F1 in FC

s = s & f1.name

S = S & VBCRLF

NEXT

Msgbox S

End Sub

FileSystemObject object

description

Provide access to your computer file system.

grammar

Scripting.filesystemObject

Description

The following code illustrates how to return a TextStream object using FileSystemObject, which is readable and writable:

Set fs = creteObject ("scripting.filesystemobject")

Set a = fs.createtextfile ("c: /testfile.txt", true)

a.writeline ("this is a test.")

a.close

In the code listed above, the CreateObject function returns FileSystemObject (FS). The CreateTextFile method then creates a file as a TextStream object (A), and the WriteLine method writes a line of text in the created text file. Close method refreshes the buffer and close the file.

Folder object

description

Provide access to all properties of a folder.

Description

The following code example shows how to get a Folder object, and how to return to an attribute:

Sub ShowFolderinfo (Folderspec)

DIM FS, F, S,

Set fs = creteObject ("scripting.filesystemobject")

Set f = fs.getFolder (Folderspec)

s = f.datecreated

Msgbox S

End Sub

Folders collection

description

A collection of all Folder objects included in a Folder object.

Description

The following code illustrates how to get a Folders collection, and how to use for Each ... next statement to access each Folder in the collection:

Sub ShowFolderList (Folderspec)

DIM FS, F, F1, FC, S

Set fs = creteObject ("scripting.filesystemobject")

Set f = fs.getFolder (Folderspec)

Set fc = f.subfolders

For Each F1 in FC

s = s & f1.name

S = S & VBCRLF

NEXT

Msgbox S

End Sub

TextStream object

description

Accelerate access to files.

grammar

TextStream. {Property | Method}

The Property and Method parameters can be any properties and methods associated with the TextStream object. Note that in practical applications, TextStream is replaced by a variable placeholder, which represents the TextStream object returned from FileSystemObject. Description

In the following code, A is the TextStream object returned by the FileSystemObject's CreateTextFile method:

Set fs = creteObject ("scripting.filesystemobject")

Set a = fs.createtextfile ("c: /testfile.txt", true)

a.writeline ("this is a test.")

a.close

WriteLine and Close are two ways to TextStream objects.

& Operators

It is used to force two expressions to make a string connection.

grammar

Result = Expression1 & Expression2

The syntax of & operators has the following parts:

Partially describes Result necessary; any string or variant variable. EXPRESSION1 is required; any expression. EXPRESSION2 must be required; any expression.

Description

If Expression is not a string, convert it into a String variant. If both expressions are string expressions, the data type of Result is string; otherwise Result is a String variant. If both expressions are null, Result is NULL. However, as long as there is an Expression is NULL, it is handled as a string ("") of zero as a length when connected to other expression. Any EMPTY type expression is also a string processing as a length zero.

* Operator

Used to multiply the two numbers.

grammar

Result = Number1 * Number2

* The syntax of the operator has the following parts:

Partially describes the necessary of Result; any numerical variable. Number1 must be required; any numerical expression. Number2 must be required; any numerical expression.

Description

Result's data type is usually the same as the most accurate expression of the data. Accuracy is from the lowest to the highest order

Byte, Integer, Long, Single, Currency, Double and Decimal. The following is exception:

If Result has a Single and a long, convert it to Double. Result's data type is Long, Single or Date variants, and beyond the correct range, converted into a Variant with Double. Result's data type is Byte variant, and it exceeds the correct range and converts into an Integer variant. Result's data type is an Integer variant, and it exceeds the correct range and converts into a long variant.

If one or two expressions are NULL expressions, Result is NULL. If an expression is EMPTY, it is handled as 0.

Note that the accuracy level used by multiplication is different from the accuracy level of addition and subtraction.

Operator

Used to ask for two sum.

grammar

Result = Expression1 Expression2

The syntax of the operator has the following parts:

Partially describes the necessary of Result; any numerical variable. EXPRESSION1 is required; any expression. EXPRESSION2 must be required; any expression. Description

It is possible to make an addition or a string connection when using the operator. To avoid confusion, use & operators to connect and improve the readability of the program code.

If at least one expression is not Variant, the following rules can be applied:

If both expressions are numerical data types (Byte, Boolean, INTEGER, Long, Single, Double, Date, Currency or Decimal) are added. Both expressions are String connections. An expression is a numerical data type and the other is any variant outside null. Addition. An expression is String and others are any variant outside null. connection. An expression is EMPTY VARIANT to return another constant expression as a result. An expression is a numeric data type, and the other is String to generate a type of non-match error. Each expression is NullResult is null.

If both expressions are Variant expressions, the following rules can be applied:

If two Variant expressions are added. Both Variant expressions are string connections. A Variant expression is a value and the other is a string addition.

For only a simple addition of only numerical data type expressions, the RESULT's data type is usually the same as the most accurate expressive data type. Accuracy is byte, integer, long, single, double, currency, and decimal by the lowest to the highest order. But the following cases:

If Result is added to a single and a long, a double. Result's data type is long, single, or date variants, and turn over the correct range and converts into a Double variant. Result's data type is BYTE variant, and is converted into an Integer variant when it exceeds the correct range of itself. Result's data type is an Integer variant, and when it exceeds the correct range of itself, it is converted to a long variant. Add a date to any data type, a date.

If one or two expressions are NULL expressions, Result is NULL. If the two expressions are EMPTY, Result is Integer. However, if only one expression is EMPTY, another expression is originally returned as a result.

Note that the accuracy level used by the addition and subtraction is different from the accuracy level used in the multiplication.

- operator

It is used to seek two numbers or represent negative values ​​of numerical expressions.

Syntax 1

Result = Number1 - Number2

Grammar 2

- Number

- The syntax of the operator has the following parts:

Partially describes the necessary of Result; any numerical variable. Number must be required; any numerical expression. Number1 must be required; any numerical expression. Number2 must be required; any numerical expression.

Description

In the syntax 1, the - operator is an arithmetic subtraction operator for two numbers. In the syntax 2, the-operator is a one-dollar load operator, indicating the value of the expression of the expression.

Result's data type is usually the same as the most accurate expression of the data. Accuracy is byte, integer, long, single, double, currency, and decimal by the lowest to the highest order.

The following cases:

If the Result is a Double and a long in the subtraction operation, it is converted into a double. Result's data type is a long, Single or Date variants, and translated into a Variant containing Double. Result's data type is a BYTE variant and is exceeded in the correct range. Convert into an Integer variant. Result's data type is an Integer variant, and it exceeds the correct range and converts into a long variant. Date and any other data type in the subtraction operation, one date. There are two Date expressions in subtraction operations, a double. If one or two expressions are NULL expressions, Result is NULL. If an expression is EMPTY, it is handled as 0.

Note that the accuracy level used by the addition and subtraction is different from the accuracy level used in the multiplication.

/ Operator

The division of the two numbers is used to return a floating point number.

grammar

Result = Number1 / Number2

The syntax of the / operator has the following parts:

Partially describes the necessary of Result; any numerical variable. Number1 must be required; any numerical expression. Number2 must be required; any numerical expression.

Description

Result's data type is usually Double or Double variants. The following is exception:

If RESULT is Byte, Integer, or Single expression, a single, unless the correct range is exceeded; if this happens, an error is generated. Both expressions are Byte, Integer or Single variants, a Single variant unless it has exceeded the correct range; RESULT is a Variant containing Double. There is a Decimal and any other data type in the division operation, a DECIMAL data type.

If one or two expressions are NULL expressions, the Result is NULL. If an expression is EMPTY, it is used as 0.

/ Operator

Used to remove the two numbers and return an integer.

grammar

Result = Number1 / Number2

The syntax of the / operator has the following parts:

Partially describes the necessary of Result; any numerical variable. Number1 must be required; any numerical expression. Number2 must be required; any numerical expression.

Description

The numerical expression is converted into Byte, Integer or Long expressions before the division operation is performed.

Typically, regardless of the RESULT is not an integer, the RESULT's data type is BYTE, BYTE variant, Integer, Integer variants, long, or long variants. Any fractional part is deleted. However, if any an expression is null, the result is NULL. If an expression is EMPTY, it is handled as 0.

^ Operator

Used to seek a number of numbers, the secondary number is an exponent value.

grammar

Result = Number ^ Exponent

^ The syntax of the operator has the following parts:

Partially describes the necessary of Result; any numerical variable. Number must be required; any numerical expression. EXPONENT must be required; any numerical expression.

Description

Number can only be negative only when Exponent is an integer value. When performing multiple index operations in the expression, the calculation order of the operator is from left to right.

Result's data type is usually Double or a Variant containing Double. However, if there is a NULL expression in Number or Exponent, Result is also null. = Operator

description

Used to assign a variable or attribute.

grammar

Variable = Value

= Operator syntax has the following sections:

Partially describes any variables or any variables of Variable or any option. Value Any numeric or string text, constant or expression.

Description

The name on the left side of the equal sign can be a simple scalar variable or an array element. The attribute on the left side of the equal sign can only be the attribute that can be written at runtime.

Addressof operator

A one-al-operator, it passes the address of the process later to an API process, which requires a function pointer in the corresponding position of the parameter table.

grammar

Addressof ProCedureName

The required procedurename specifies which process of the address to be passed. This process must be a process in a standard module module in an engineering that calls commands.

Description

When the name of a process appears in a parameter list, usually the process has been calculated, and the address of the process returns value will also be passed. AddressOf allows the address of the process to be passed to a Windows API function in the Dynamic Link Library (DLL) instead of passing the return value of the process. The API function can then use this address to call the corresponding BASIC process, this process is the callback we know. The AddressOf operator appears in the call to the API process.

Although the process pointer can be transferred between the ADDRESSOF operator between the BASIC procedure, a function cannot be called from the Basic inside the BASIC. That is to say, for example, a class written using Basic cannot use such a pointer to call back its own controller. When using the AddressOf operator to pass a process of a process between the BASIC, the parameter type of the called process must be defined as as long.

WARNING If you don't fully understand the concept of function callbacks, use the Addressof operator that can lead to unexpected results. It is necessary to understand how the callback BASIC part works, and how the DLL of the transmitted function address is working. Debugging such interactions is very difficult because the program and the development environment run in the same process. In some cases, the system's debugging may be impossible.

Note DLLs that can be compiled using Microsoft Visual C (or similar tools) to create their own callback function prototype. To work with the Addressof operator, your prototype must use the __stdcall call agreement. The default call agreement (__cdecl) cannot work with the Addressof operator.

Because a callback call program is not in the user's own program, it is important to ensure that the error in the callback process is not returned to the caller. This requirement can be achieved by placing the ON ERROR RESUME NEXT statement on the start of the callback process.

And operator

Used to logically connect two expressions.

grammar

Result = expression1 and expression2

The syntax of the And operator has the following parts:

Partially describes the necessary of Result; any numerical variable. EXPRESSION1 is required; any expression. EXPRESSION2 must be required; any expression.

Description

If the values ​​of the two expressions are true, Result is TRUE. If the value of one of the expressions is false, Result is False. The following table shows how to determine the result:

Expression2 expression1 if it is and the result is also the same bit expression values ​​for two-by-bit comparison TrueTrueTrueTrueFalseFalseTrueNullNullFalseTrueFalseFalseFalseFalseFalseNullFalseNullTrueNullNullFalseFalseNullNullNullAnd operator, and set the corresponding bit in the result according to the following table:

If the bit of Expression1 is the bit of the expression2, the bit is resulting 000010100111

Compare operator

Used to compare expressions.

grammar

Result = Expression1 ComparisonOperator Expression2

Result = Object1 is Object2

Result = String Like Pattern

The comparison operator has the following parts:

Partially describes the necessary of Result; any numerical variable. Expression is required; any expression. Comparisonoperator is required; any comparison operator. Object is required; any object name. String must be; any string expression. Pattern must be required; any range of string expressions or characters.

Description

A series of comparative operators in the following tables and the rules of RESULT are TRUE, FALSE or NULL:

Operator True ifFalse ifNull if (less than) = expression2expression1 or expression2 = Null <= (less than or equal to) expression1 <= expression2expression1> expression2expression1 or expression2 = Null> (greater than) expression1> expression2expression1 <= expression2expression1 or expression2 = null> = (greater than or equal to) expression1> = expression2expression1 expression2expression1 or expression2 = null <> (not equal) expression1 <> expression2expression1 = expression2expression1 or expression2 = null

Note that IS and Like operators have specific comparison functions, they are different from operators in the table.

When comparing two expressions, it may be difficult to determine how the expression to be compared is a digital or string. The following table will explain how to compare expressions, or how to get comparison results when one of the expressions are not Variant.

If both expressions are numerical data types (Byte, Boolean, Integer, Long, Single, Double, Date, Currency or Decimal) are numerically compared. Both expressions are string to string comparison an expression is a numeric data type and the other is a digital variant, or a numeric comparison can be performed for a number. An expression is a numeric data type and the other is an error that cannot be converted into a string variant generating type mismatch. An expression is String, and the other is a string comparison in addition to any Variant other than Null. An expression is EMPTY and the other is a numerical data type for numerical comparisons, using 0 as an EMPTY expression. An expression is EMPTY and the other is String to string comparison, using a string ("") of zero ("") as an EMPTY expression. If Expression1 and Expression2 are Variant expressions, their basic types determine comparison. The following table illustrates how to compare expressions or indicate that by comparing results, this result depends on the basic type of Variant:

If two Variant expressions are numerical comparisons. Two Variant expressions are string comparisons for strings. A Variant expression is a value and the other is a string numerical expression is smaller than a string expression. A Variant expression is EMPTY and the other is a numerical comparison, using 0 as an EMPTY expression. A Variant expression is EMPTY and the other is a string for string comparison, using a string ("") length zero ("") as an EMPTY expression. Both Variant expressions are EMPTY expressions.

When a Single is compared to a Double, Double will be rounded and have the same accuracy as this SINGLE.

If a currency compares to a Single or Double, Single or Double is converted into a currency. Similarly, when a decimal is compared to a Single or Double, Single or Double will be converted into a Decimal. For currency, any decimal less than .0001 will be discarded, for Decimal, any decimal less than 1e-28 will be discarded, or an overflow error may occur. Abandoning such a fractional portion will make the original unequal number of two values ​​after comparison.

EQV operator

Used to logic equivalence operations for two expressions.

grammar

Result = expression1 EQV Expression2

The syntax of the EQV operator has the following parts:

Partially describes the necessary of Result; any numerical variable. EXPRESSION1 is required; any expression. EXPRESSION2 must be required; any expression.

Description

If an expression is null, Result is also null. If the expression is not null, it is determined according to the table below:

If Expression1 is, EXPRESSION2 is RESULT, Truetruetruefalsefalsefalsetruefalsefalsetrue

The EQV operator compares the location in the two numerical expressions, and sets the corresponding bit in the resulting bit according to the table below:

If the bit of Expression1 is a result, the bit in Expression2 is RESULT 001010100111

IMP operator

It is used to logical implication operations for two expressions.

grammar

Result = expression1 Imp Expression2

The syntax of the IMP operator has the following sections: section describes Result necessary; any numerical variable. EXPRESSION1 is required; any expression. EXPRESSION2 must be required; any expression.

Description

The following table shows how to determine the result:

If Expression1 is, EXPRESSION2 is RESULTRUETRUEFALSEFALSETRUEFALSEFALSETRUEFALSENULLRUENULLRRUEFALSENULLRRUENULLRUETRUEFALSENULLNULLNULLNULLLNULLNULLNULLNULL

The IMP operator compares the same bit in the two numerical expressions, and sets the corresponding bit in the resulting bit according to the following table:

If the bit of Expression1 is the bit in Expression2, it is resulting 001011001111

IS operator

The reference variable used to compare two objects.

grammar

Result = Object1 is Object2

The syntax of the IS operator has the following sections:

Partially describes the necessary of Result; any numerical variable. Object1 is required; any object name. Object2 must be required; any object name.

Description

If both Object1 and Object2 reference the same object, Result is true; otherwise, Result is false. There are many ways to bring two variables to the same object.

In the following example, A and B have been set to the same object as c reference:

SET A = B

In the following example, the objects referenced by A and B are the same as C:

SET A = C

SET B = C

LIKE operator

Used to compare two strings.

grammar

Result = String Like Pattern

The grammar of the Like operator has the following parts:

Partially describes the necessary of Result; any numerical variable. String must be; any string expression. Pattern is required; any string expression, follow the mode matching conventions in the "Description".

Description

If String matches Pattern, Result is true; if it does not match, the Result is false. But if there is a null in String or Pattern, Result is NULL.

The characteristics of the LIKE operator are different from the Option COMPARE statement. The default string comparison method of each module is Option Compare Binary.

In a string comparison, the result of Option Compare Binary is obtained from the order of sorting based on the internal binary representation of characters. In Microsoft Windows, the sort order is determined by the code page. The following example shows the usual binary sort order:

A

MOD operator

It is used to remove the two numbers and only return the remainder.

grammar

Result = Number1 Mod Number2

The syntax of the MOD has the following parts:

Partially describes the necessary of Result; any numerical variable. Number1 must be required; any numerical expression. Number2 must be required; any numerical expression.

Description

When the MOD operation or the remaining number is calculated, the operator divides Number1 with Number2 (round the floating point number to an integer), and returns the remainder as the value of the Result. For example, in the following expression, a (result) is equal to 5. A = 19 mod 6.7

Generally speaking, regardless of whether RESULT is an integer, the RESULT type is Byte, Byte variant, Integer, Integer variant, long, or a Variant containing long. Any fractional part is deleted. However, if any NULL, the type of expression appears, the Result will be null. Any EMPTY type expression is used as 0.

NOT operator

It is used to logically negate the expression.

grammar

Result = NOT EXPRESSION

The syntax of the NOT operator has the following parts:

Partially describes the necessary of Result; any numerical variable. Expression is required; any expression.

Description

The following table shows how to determine the result:

If Expression is RESULT for Truefalsefalsetruenullnull

In addition, the NOT operator changes the bit value of any variable, and sets the corresponding bit in the following table:

If the bit in the expression is 0110 in Result

OR operator

Used to logically analyze two expressions.

grammar

Result = expression1 or expression2

The syntax of the OR operator has the following parts:

Partially describes the necessary of Result; any numerical variable. EXPRESSION1 is required; any expression. EXPRESSION2 must be required; any expression.

Description

If there is at least one of the two expressions, Result is true. The following table shows how to determine the result:

If Expression1 is, EXPRESSION2 is RESUETRUETRUEFALSETRUEFALSEFALSEFALSENUEFALSEFALSEFALSEFALSENULLNULLNULLRRUETRUENULLLNULLNULLNULLNULLLNULLNULLNULLNULL

The OR operator also compares the same bit in the two numerical expressions, and sets the corresponding bit in Result according to the following table:

If the bit of Expression1 is the bit in Expression2, you are Result 000011111111

XOR operator

Used to logically mutually exclusion or operations for both expressions.

grammar

[Result =] Expression1 XOR Expression2

The syntax of the XOR operator has the following parts:

Some describe the Result optional; any numerical variable. EXPRESSION1 is required; any expression. EXPRESSION2 must be required; any expression.

Description

If there is one and only one value is true, Result is TRUE. However, if there is a null in the expression, Result is also NULL. When the two expressions are NULL, it is determined according to the table below:

If Expression1 is, EXPRESSION2 is RESULT for TruetruefalSetruefalsetruefalsetruetruefalsefalsefalse

The XOR operator can be used as a logical operator or as a bit operator. The bit comparison of the two expressions of the mutually exclusive logic, the result is description by the following table: if Expression1 is and expression2 is RESULT 000011101110

Atendofline property

description

Read-only properties, in the TextStream file, if the file pointer is in front of the row tail mark, then this attribute value returns true; otherwise returns false.

grammar

Object.atendofline

Object is always the name of a TextStream object.

Description

The AtendOfline property is only applied to the textStream file that has been opened for read; otherwise it will be wrong.

The following code illustrates the usage of the ATENDOFLINE property:

DIM FS, A, RETSTRING

Set fs = creteObject ("scripting.filesystemobject")

Set a = fs.opentextfile ("c: /testfile.txt", forreading, false

Do While a.atendofline <> TRUE

Retstring = A.Read (1)

...

Loop

a.close

Atendofstream properties

description

Read-only properties, if the file pointer is at the end of the TextStream file, the attribute value returns true; otherwise returns false.

grammar

Object.atendofstream

Object is always the name of a TextStream object.

Description

The AtendOfStream property is only applied to the TEXTSTREAM file that has been opened for read; otherwise it will be wrong.

The following code illustrates the usage of the ATENDOFSTREAM property:

DIM FS, A, RETSTRING

Set fs = creteObject ("scripting.filesystemobject")

Set a = fs.opentextfile ("c: /testfile.txt", forreading, false

Do While a.atendofstream <> TRUE

Retstring = a.readline

...

Loop

a.close

Attributes property

description

Set or return the properties of the file or folder. Read / write or read only, depending on the attribute.

grammar

Object.attributes [= newattributes]

Attributes properties have the following parts:

Partially describes Object necessary. Always the name of a FILE or FOLDER object. Newattributes are optional. If provided, NewAttribute is the new attribute value of the specified Object.

Set

The NewAttributes parameter may be any of the following or any logical combinations:

Constant value describes Normal0 General Files. No properties are not set. Readonly1 read-only files. The property is read / written. Hidden2 hidden files. The property is read / written. System4 system file. The property is read / written. Volume8 Disk drive scroll. The attribute is read-only. Directory16 folder or directory. The attribute is read-only. Archive32 has changed from the last backup. The property is read / written. Alias64 links or shortcuts. The attribute is read-only. Compressed128 compressed files. The attribute is read-only.

Description

The following code uses a file to illustrate the usage of Attributes properties:

Sub setCleArchivebit (filespec)

DIM FS, F, R

SET FS = CreateObject ("scripting.filesystemObject") set f = fs.getfile (fs.getfilename (filespec))

IF f.attributes and 32 then

R = MSGBOX ("THE ARCHIVE BIT IS SET, Do You Want To Clear IT?", Vbyesno, "Set / Clear Archive Bit")

IF r = vbyes then

f.attributes = f.attributes - 32

MsgBox "Archive Bit is Cleared."

Else

Msgbox "Archive Bit Remains Set."

END IF

Else

R = msgbox ("THE ARCHIVE BIT IS Not set. Do you want to set it?", vbyesno, "set / clean archive bit")

IF r = vbyes then

f.attributes = f.attributes 32

Msgbox "Archive Bit is Set."

Else

Msgbox "Archive Bit Remains Clear."

END IF

END IF

End Sub

AvailableSpace properties

description

Returns the user free space capacity available on the specified drive or network sharing.

grammar

Object.availablespleSpace

Object is always a Drive object.

Description

In general, the return value of the AvailableSpace property is the same as the return value of the FreeSpace property. For computer systems that support quotas, there may be differences between two values.

The following code illustrates the usage of the AvailableSpace property:

Sub showavailablespace (drvpath)

DIM FS, D, S

Set fs = creteObject ("scripting.filesystemobject")

SET D = fs.getdrive (fs.getdrivename (drvpath))

S = "Drive" & ucase (drvpath) & "-"

S = S & D.VoluMename & VBCRLF

S = S & "Available Space:" & FormatNumber (D.availablespace / 1024, 0)

S = S & "Kbytes"

Msgbox S

End Sub

Calendar attribute

Returns or sets a value to point out the type of the calendar used in the project.

One of the following settings can be used for Calendar:

Set value description VBCalgReg0 uses the Gregorian calendar (default). Vbcalhijri1 uses the Hijri calendar.

Description

You can program only Calendar properties. For example, use a Hijri calendar, use:

Calendar = vbcalhijri

Column property

description

Read-only properties, return the number of the current character position in the TextStream file.

grammar

Object.column

Object is always the name of a TextStream object.

Description

After writing a new line character, but before writing any other characters, the value of Column is 1. CompareMode property

description

Set or return the comparison mode of the comparison string keyword in a Dictionary object.

grammar

Object.comparemode [= compare]

The CompareMode property has the following sections:

Partially describes Object necessary. Always a name of a Dictionary object. Compare is optional. If provided, Compare is a value representing the comparison mode, which is used in a function like Strcomp.

Set

The COMPARE parameter can have the following value:

Constant value description VBuseCompareOption-1 compares the settings of the Option Compare statement. VbinaryCompare 0 for binary comparison. VbtextCompare 1 performs text comparisons. VBDatabaseCompare 2 is only used for Microsoft Access. Perform a comparison based on information in your own database.

Description

If you try to change the comparison mode of the Dictionary object already containing the data, it will be wrong.

The parameter value used by the CompareMode property is the same as the COMPARE parameter used by the STRComp function. A comparison of specific Locale IDs (LCIDs) can be used with values ​​greater than 2.

The count property returns a long (long integer) that contains the number of objects in the collection. Read only.

Count attribute

description

Returns the number of entries in the collection or Dictionary object. Read only.

grammar

Object.count

Object is always "applying to the name of a list in the list.

Description

The following code illustrates how the reference property is used:

DIM A, D, I 'Create some variables

SET D = CreateObject ("scripting.dictionary")

D. ADD "A", "athens" 'adds some keywords and entries.

D.ADD "B", "belgrade"

D.ADD "C", "cairo"

A = d.keys' Get keywords

For i = 0 to d.count -1 'spreads over an array

Print A (i) 'printing keyword

NEXT

...

Datecreated attribute

description

Returns the creation date and time of the specified file or folder. Read only.

grammar

Object.datecreated

Object is always a File or Folder object.

Description

The following code uses a file to illustrate the usage of the datecreated property:

Sub showfileinfo (filespec)

DIM FS, F, S

Set fs = creteObject ("scripting.filesystemobject")

Set f = fs.getfile (filespec)

s = "created:" & f.datecreated

Msgbox S

End Sub

DateLastAccessed properties

description

Returns the date and time of the last access to the specified file or folder. Read only.

grammar

Object.dateLastAccessed

Object is always a File or Folder object.

Description

The following code uses a file to illustrate the usage of the DATELASTACCESSED property:

Sub ShowFileAccessInfo (filespec)

DIM FS, F, S

Set fs = createObject ("scripting.filesystemObject") set f = fs.getfile (filespec)

S = ucase (filespec) & vbrlf

S = S & "CREATED:" & f.datecreated & vbcrlf

S = S & "Last Accessed:" & f.dateLastAccessed & Vbcrlf

S = S & "Last Modified:" & f.dateLastModified

Msgbox S, 0, "File Access Info"

End Sub

Key this method determines its behavior by the next level of operating system. If the operating system does not support providing time information, no information is returned.

DateLastModified property

description

Returns the last time to modify the date and time of the specified file or folder. Read only.

grammar

Object.dateLastModified

Object is always a File or Folder object.

Description

The following code uses a file to illustrate the usage of the DATELASTMODIFIED property:

Sub ShowFileAccessInfo (filespec)

DIM FS, F, S

Set fs = creteObject ("scripting.filesystemobject")

Set f = fs.getfile (filespec)

S = ucase (filespec) & vbrlf

S = S & "CREATED:" & f.datecreated & vbcrlf

S = S & "Last Accessed:" & f.dateLastAccessed & Vbcrlf

S = S & "Last Modified:" & f.dateLastModified

Msgbox S, 0, "File Access Info"

End Sub

Description attribute

Returns or sets a string expression that contains a descriptive string associated with an object. Readable / writable.

For ERR objects, return or set descriptive strings associated with errors.

Description

Description attribute settings a short description of the error. This property can be used to remind users if they cannot handle or do not want to handle errors. When generating a user-defined error, a brief statement of this error is specified to the Description property. If DESCRIPTION is not filled in data, and the value of Number is consistent with the Visual Basic runtime, then the character string returned to the ERROR function is placed in the Description when generating an error.

Drive attribute

description

Returns the drive symbols in the specified file or folder. Read only.

grammar

Object.drive

Object is always a File or Folder object.

Description

The following code illustrates the usage of the Drive property:

Sub ShowFileAccessInfo (filespec)

DIM FS, F, S

Set fs = creteObject ("scripting.filesystemobject")

Set f = fs.getfile (filespec)

S = f.name & "on drive" & ucase (f.drive) & vbcrlfs = s & "created:" & f.datecreated & vbcrlf

S = S & "Last Accessed:" & f.dateLastAccessed & Vbcrlf

S = S & "Last Modified:" & f.dateLastModified

Msgbox S, 0, "File Access Info"

End Sub

Driveletter attribute

description

Returns a physical local drive or network shared drive letter. Read only.

grammar

Object.driveletter

Object is always a Drive object.

Description

If the specified drive does not associate with a drive letter, for example, the DRAVELETER attribute returns a 0-byte length string (").

The following code illustrates the usage of the Driveletter property:

Sub Showdriveletter (Drvpath)

DIM FS, D, S

Set fs = creteObject ("scripting.filesystemobject")

SET D = fs.getdrive (fs.getdrivename (drvpath))

s = "Drive" & D.Driveletter & ": -"

S = S & D.VoluMename & VBCRLF

s = S & "Free Space:" & FormatNumber (D.Freespace / 1024, 0)

S = S & "Kbytes"

Msgbox S

End Sub

Drives attribute

description

Returns a DRIVES collection that contains all available Drive objects on your local machine.

grammar

Object.drives

Object is always a FileSystemObject.

Description

For delete media drives, you don't need to insert a media, you can appear in the Drives collection.

You can use the for Each ... Next structure throughout the DRIVES collection, as shown in the following code:

Sub showdriveList

DIM FS, D, DC, S, N

Set fs = creteObject ("scripting.filesystemobject")

SET DC = fs.drives

For Each D in DC

S = S & D.Driveletter & "-"

IF D.DriveType = 3 THEN

n = d.ShareName

Else

n = d.volumename

END IF

S = S & N & VBCRLF

NEXT

Msgbox S

End Sub

DriveType properties

description

Returns a value indicating the type of the specified drive.

grammar

Object.driveType

Object is always a Drive object.

Description

The following code illustrates the usage of the DriveType property:

Sub ShowdriveType (DRVPATH)

DIM FS, D, S, T

SET FS = CreateObject ("scripting.filesystemObject") SET D = fs.getdrive (drvpath)

SELECT CASE D.DRIVETYPE

Case 0: t = "unknown"

Case 1: t = "removeable"

Case 2: t = "fixed"

Case 3: t = "network"

Case 4: T = "CD-ROM"

Case 5: T = "RAM Disk"

End SELECT

S = "Drive" & D.Driveletter & ": -" & t

Msgbox S

End Sub

FILES attribute

description

Returns a Files collection consisting of all File objects, which contain those files that have set hidden and system file properties in the specified folder.

grammar

Object.files

Object is always a Folder object.

Description

The following code illustrates the usage of the files attribute:

Sub ShowFileList (Folderspec)

DIM FS, F, F1, FC, S

Set fs = creteObject ("scripting.filesystemobject")

Set f = fs.getFolder (Folderspec)

Set fc = f.files

For Each F1 in FC

s = s & f1.name

S = S & VBCRLF

NEXT

Msgbox S

End Sub

FILESYSTEM attribute

description

Returns the file system type used by the specified drive.

grammar

Object.filesystem

Object is always a Drive object.

Description

The returned types that can be obtained include FAT, NTFS, and CDFS.

The following code illustrates the usage of the FileSystem property:

Sub ShowFileSystemType

DIM FS, D, S

Set fs = creteObject ("scripting.filesystemobject")

Set d = fs.getdrive ("e:")

s = D.FileSystem

Msgbox S

End Sub

FreeSpace properties

description

Returns the remaining space capacity of users available on the specified drive or network shared. Read only.

grammar

Object.Freespace

Object is always a Drive object.

Description

In general, the return value of the FreeSpace property and the return value of the AvailableSpace property are the same. For a computer system that supports the limit, the two may vary.

The following code illustrates the usage of the FreeSpace property:

Sub ShowFreespace (drvpath)

DIM FS, D, S

Set fs = creteObject ("scripting.filesystemobject")

SET D = fs.getdrive (fs.getdrivename (drvpath))

S = "Drive" & ucase (drvpath) & "-"

S = S & D.VoluMename & VBCRLF

S = S & "Free Space:" & FormatNumber (DREESPACE / 1024, 0) S = S & "Kbytes"

Msgbox S

End Sub

HelpContext attribute

Return or set a string expression that contains the context ID of the subject in the Microsoft Windows Help file. Readable / writable.

Description

The HelpContext property is used to automatically display the help topics specified in the HelpFile property. If HelpFile and HelpContext are empty, check the value of Number. If the value of Number is consistent with the Visual Basic runtime error, this error uses the Visual Basic Help Conclusion ID. If the value of Number is inconsistent with the Visual Basic error, the content of the Visual Basic Help file is displayed on the screen.

Note that some routines should be written in the application to handle common errors. When using object programming, you can use this object's help file to increase the quality of the error, and if the error cannot be remedy, you will display a meaningful message to the user.

Helpfile property

Returns or set a string expression to represent the full qualified path of the help file. Readable / writable.

Description

If the help file is specified in HelpFile, the help file is automatically called when the user presses the Help button (or) in the error message dialog. If the HelpContext property contains a valid context ID of the specified file, the topic is automatically displayed. If heLpFile is not specified, the Visual Basic Help file is displayed.

Note that some routines should be written in the application to handle common errors. When using object programming, you can use this object's help file to increase the quality of the error, and if the error cannot be remedy, you will display a meaningful message to the user.

Isready property

description

Returns true if the specified drive is ready; otherwise returns false.

grammar

Object.isready

Object is always a Drive object.

Description

For delete media drives and CD-ROM drives, ISREADY returns TRUE only when an appropriate media is inserted.

The following code illustrates the usage of the IsReady property:

Sub ShowdriveInfo (Drvpath)

DIM FS, D, S, T

Set fs = creteObject ("scripting.filesystemobject")

SET D = fs.getdrive (drvpath)

SELECT CASE D.DRIVETYPE

Case 0: t = "unknown"

Case 1: t = "removeable"

Case 2: t = "fixed"

Case 3: t = "network"

Case 4: T = "CD-ROM"

Case 5: T = "RAM Disk"

End SELECT

S = "Drive" & D.Driveletter & ": -" & t

IF D.Isready Then

S = S & VBCRLF & "Drive is ready."

Else

S = S & VBCRLF & "Drive is not ready."

END IF

Msgbox S

End Sub

IsroTFolder property

description

Returns true if the specified folder is the root folder; otherwise returns false.

grammar

Object.isrootfolder

Object is always a Folder object.

Description

The following code illustrates the usage of the IsRootFolder property:

DIM FS

Set fs = creteObject ("scripting.filesystemobject")

Sub DisplayLevelDepth (PathSpec)

DIM F, N

Set f = fs.getFolder (PathSpec)

IF F.ISROOTFOLDER THEN

Msgbox "The Specified Folder Is The Root Folder."

Else

Do Until F.isrootfolder

Set f = f.parentfolder

n = n 1

Loop

MsgBox "The Specified Folder Is Nested" & N & "Levels Deep."

END IF

End Sub

Item property

description

For the KEY, setting or return to the Dictionary object. For collections, based on the specified Key, it returns an Item. Read / write properties.

grammar

Object.Item (key) [= newItem]

The ITEM attribute has the following sections:

Partially describes Object necessary. Always a collection or Dictionary object name. Key must be. Key associated with the entry that is retrieved or added. NEWITEM is optional. For Dictionary objects only; applications that do not have a collection. If provided, NewItem is a new value associated with the specified Key.

Description

If you don't find Key when you change a ITEM, create a new key with the specified NewItem. If you don't find Key when trying to return an existing entry, create a new key, and its corresponding entry is empty.

Key property

description

Set a KEY in a Dictionary object.

grammar

Object.Key (key) = newkey

The key attribute has the following sections:

Partially describes Object necessary. Always a Dictionary object name. Key must be. Changed Key value. Newkey is required. Replace the new value of the specified key.

Description

If you change a key, there is no runtime error when you find a KEY.

Lastdllerror properties

Returns the system error number generated due to the call dynamic link library (DLL). Read only.

Description

The LastDLLLERROR attribute is only available for DLL calls made by the Visual Basic code. When calling, the called function is usually returned to a code indicating success or a failure, and the data is filled with the LastDLLLERROR attribute. Please check the documentation of the DLL function, determine the return value, indicating that it is successful or failed. As long as you return a fail code, Visual Basic's application should check the LastDLlerRROR attribute immediately. There will be no exceptions when setting the lastdllerror properties.

Line attribute

description

Read-only properties, return the current line number in a TextStream file.

grammar

Object.line

Object is always the name of a TextStream object.

Description

After the file is turned on, the value of Line is 1 before writing anything.

Name attribute description

Set or return to the specified file or folder name. Read / write properties.

grammar

Object.name [= newname]

Name properties have the following parts:

Partially describes Object necessary. Always the name of a FILE or FOLDER object. NewName is optional. If provided, NewName is the new name of the specified Object.

Description

The following code illustrates the usage of the Name property:

Sub ShowFileAccessInfo (filespec)

DIM FS, F, S

Set fs = creteObject ("scripting.filesystemobject")

Set f = fs.getfile (filespec)

S = F.Name & "On Drive" & Ucase (f.drive) & vbcrlf

S = S & "CREATED:" & f.datecreated & vbcrlf

S = S & "Last Accessed:" & f.dateLastAccessed & Vbcrlf

S = S & "Last Modified:" & f.dateLastModified

Msgbox S, 0, "File Access Info"

End Sub

Number attribute

Returns or sets the value indicating the error. Number is the default attribute of ERR objects. Readable / writable.

Description

When the object returns a user-defined error, the number of selected error codes is added to the VbObjectError constant, and it is set to Err.Number. For example, returning to the number 1051 with the error code with the following code:

Err.raise Number: = VbobjectError 1051, Source: = SomeClass

ParentFolder properties

description

Returns the parent folder object of the specified file or folder. Read only.

grammar

Object.parentFolder

Object is always a File or Folder object.

Description

The following code uses a file to illustrate the usage of the ParentFolder property:

Sub ShowFileAccessInfo (filespec)

DIM FS, F, S

Set fs = creteObject ("scripting.filesystemobject")

Set f = fs.getfile (filespec)

S = ucase (f.name) & "in" & ucase (f.parentFolder) & vbcrlf

S = S & "CREATED:" & f.datecreated & vbcrlf

S = S & "Last Accessed:" & f.dateLastAccessed & Vbcrlf

S = S & "Last Modified:" & f.dateLastModified

Msgbox S, 0, "File Access Info"

End Sub

Path property

description

Returns the path to the specified file, folder, or drive.

grammar

Object.path

Object is always a file, folder, or drive object.

Description

For the drive letter, the root drive is not included. For example, the path to the C driver is C:, not C: /. The following code uses a File object to illustrate the usage of the Path property:

Sub ShowFileAccessInfo (filespec)

DIM FS, D, F, S

Set fs = creteObject ("scripting.filesystemobject")

Set f = fs.getfile (filespec)

s = ucase (f.path) & vbcrlf

S = S & "CREATED:" & f.datecreated & vbcrlf

S = S & "Last Accessed:" & f.dateLastAccessed & Vbcrlf

S = S & "Last Modified:" & f.dateLastModified

Msgbox S, 0, "File Access Info"

End Sub

Rootfolder properties

description

Returns a Folder object that represents a root folder of a specified drive. Read-only properties.

grammar

Object.rootfolder

Object is always a Drive object.

Description

All files and folders included on the drive can be accessed using the returned Folder object.

SerialNumber property

description

Returns the decimal serial number for unique identifier disk volume label.

grammar

Object.serialnumber

Object is always a Drive object.

Description

You can use the SerialNumber property to ensure that the correct disk is inserted into a drive with delete media.

The following code illustrates the usage of the serialNumber property:

Sub ShowdriveInfo (Drvpath)

DIM FS, D, S, T

Set fs = creteObject ("scripting.filesystemobject")

Set d = fs.getdrive (fs.getdrivename (fs.getabsolutepathname (drvpath)))

SELECT CASE D.DRIVETYPE

Case 0: t = "unknown"

Case 1: t = "removeable"

Case 2: t = "fixed"

Case 3: t = "network"

Case 4: T = "CD-ROM"

Case 5: T = "RAM Disk"

End SELECT

S = "Drive" & D.Driveletter & ": -" & t

S = S & VBCRLF & "SN:" & D. Serialnumber

Msgbox S

End Sub

ShareName attribute

description

Returns the network sharing name of the specified drive.

grammar

Object.sharename

Object is always a Drive object.

Description

If the Object is not a network drive, the ShareName property returns a string ("") of 0 byte length.

The following code illustrates the usage of the Sharename property:

Sub ShowdriveInfo (Drvpath)

DIM FS, D, S

Set fs = creteObject ("scripting.filesystemObject") SET D = fs.getdrive (fs.getdrivename (fs.getabsolutepathname (drvpath))))

S = "Drive" & D.Driveletter & ": -" & D.ShareName

Msgbox S

End Sub

ShortName property

description

Returns the short name word used by the program that requires an earlier 8.3 naming agreement.

grammar

Object.shortname

Object is always a File or Folder object.

Description

The following code illustrates the usage of the shortname property with a File object:

Sub ShowshName (filespec)

DIM FS, F, S

Set fs = creteObject ("scripting.filesystemobject")

Set f = fs.getfile (filespec)

s = "The short name for" & "& ucase (f.name)

S = S & "& VBCRLF

S = S & "IS:" & "& f.shortname &"

Msgbox S, 0, "Short Name Info"

End Sub

Shortpath property

description

Returns the short path used by the program that requires an earlier 8.3 file naming convention.

grammar

Object.shortpath

Object is always a File or Folder object.

Description

The following code illustrates the usage of the shortname property with a File object:

Sub ShowshPath (filespec)

DIM FS, F, S

Set fs = creteObject ("scripting.filesystemobject")

Set f = fs.getfile (filespec)

s = "The short path for" & "& ucase (f.name)

S = S & "& VBCRLF

S = S & "IS:" & "& f.shortpath &" "

Msgbox S, 0, "Short Path Info"

End Sub

Size attribute

description

For files, returns the specified file size in bytes. For a folder, returns the size of all files and subfolders contained in the folder in bytes.

grammar

Object.size

Object is always a File or Folder object.

Description

The following code uses a Folder object to illustrate the usage of the size property:

Sub ShowFoldersize (filespec)

DIM FS, F, S

Set fs = creteObject ("scripting.filesystemobject")

Set f = fs.getfolder (filespec)

S = ucase (f.name) & "uses" & f.size & "bytes."

Msgbox S, 0, "Folder Size Info" End Sub

Source attribute

Returns or sets a string expression to indicate the name of the object or application originally generated. Readable / writable.

Description

The source property is a string expression that specifies an object to generate an error; this expression is usually the class name or program of the program design. When the program code cannot process an error generated by the access object, use the Source to provide a message. For example, if you generate an "divided" error when accessing Microsoft Excel, Microsoft Excel set err.Number to represent the error code of this error and set the source to Excel.Application.

When the error is generated, Source is the program's programming ID. For class modules, Source should include a name with a Project.class form. When an unpredictable error occurs in the code, the Source property will automatically fill in the data. For errors in the standard module, SOURCE contains engineering names. For errors in the class module, Source contains names with the Project.Class form.

Subfolders attribute

description

Returns a Folders collection that contains all folders, which are included in a particular folder, including those folders that have hidden and system file properties.

grammar

Object.subfolders

Object is always a Folder object.

Description

The following code illustrates the usage of the Subfolders property:

Sub ShowFolderList (Folderspec)

DIM FS, F, F1, S, SF

Set fs = creteObject ("scripting.filesystemobject")

Set f = fs.getFolder (Folderspec)

Set sf = f.subfolders

For Each F1 in sf

s = s & f1.name

S = S & VBCRLF

NEXT

Msgbox S

End Sub

TOTALSIZE attribute

description

Returns the total space size of the drive or network share in bytes.

grammar

Object.totalsize

Object is always a Drive object.

Description

The following code illustrates the usage of the Totalsize property:

Sub ShowspaceInfo (Drvpath)

DIM FS, D, S

Set fs = creteObject ("scripting.filesystemobject")

Set d = fs.getdrive (fs.getdrivename (fs.getabsolutepathname (drvpath)))

S = "Drive" & D.Driveletter & ":"

S = S & VBCRLF

S = S & "Total Size:" & FormatNumber (D. Totalsize / 1024, 0) & "Kbytes"

S = S & VBCRLF

S = S & "Available:" & FormatNumber (D. Availablespace / 1024, 0) & "Kbytes"

Msgbox S

End Sub

TYPE attribute

description

Returns information about a file or folder type. For example, for a file ending with .TXT, return "Text Document". grammar

Object.type

Object is always a File or Folder object.

Description

The following code illustrates the usage of the Type property that returns a folder type. In this example, trying to provide the path of the Recycle BIN or other unique folders to the process.

Sub showfilesize (filespec)

DIM FS, F, S

Set fs = creteObject ("scripting.filesystemobject")

Set f = fs.getfolder (filespec)

S = ucase (f.name) & "IS A" & f.type

Msgbox S, 0, "File Size Info"

End Sub

Volumename properties

description

Set or return the volume label name of the specified drive. Read / write properties.

grammar

Object.volumename [= newname]

The Volumename property has the following parts:

Partially describes Object necessary. Always a name of a Drive object. NewName is optional. If provided, NewName is a new name specified for Object.

Description

The following code illustrates the usage of the Volumename property:

Sub ShowvolumeInfo (Drvpath)

DIM FS, D, S

Set fs = creteObject ("scripting.filesystemobject")

Set d = fs.getdrive (fs.getdrivename (fs.getabsolutepathname (drvpath)))

S = "Drive" & D.Driveletter & ": -" & D.Volumename

Msgbox S

End Sub

AppActivate statement

Activate an application window.

grammar

Appactivate Title [, Wait]

The syntax of the AppActivate statement has the following name parameters:

Partially describes Title required. String expressions, the title of the application window to be activated. You can replace the Title using the task identification code returned by the shell function to activate the application. Wait is optional. Boolean Value, illustrates whether the application called before another application has focus. If false (default), then even if the calling application does not focus, the specified application is activated directly. If true, the calling application will activate the specified application after the focus is attached.

Description

The AppActivate statement moves the focus to a named application or window, but does not affect whether the focus maximizes or minimizes. When the user takes action to change the focus or turn the window, the focus will move from the active application window. You can start an application with a shell function and set a window style.

When deciding which application is activated, compare Title with the title string of each running application. If there is no exact match, activate any such application whose title string begins with a title. If there is a lot of instances named by Title, any instance is activated.

BEEP statement

A tone is issued by the computer speaker.

grammar

BEEP

Description

The frequency and time length of the call depends on the hardware and system software and different from the computer. .

Call statement

Transfer control to a SUB process, function, or dynamic connection library (DLL) process. grammar

[Call] Name [argumentlist]

The syntax of the Call statement has the following sections:

Some describe the Call optional parameters; If this keyword is specified, ArgumentList must add parentheses, such as: Call myproc (0) Name necessary parameters, the process name to be called. argumentlist

Description

When you call a process, don't have to use the Call keyword. If you use the Call keyword to call a process that requires a parameter, ArgumentList must add parentheses. If the Call keyword is omitted, you must also omit the brackets outside ArgumentLis. If you use a Call syntax to call an internal function or a user-defined function, the return value of the function will be discarded.

To pass the entire array to a process, use an array name, and then add air brackets after the array name.

CHDIR statement

Change the current directory or folder.

grammar

Chdir path

The necessary path parameters are a string expression that indicates which directory or folder will become a new default directory or folder. Path may contain the drive. If no drive is specified, ChDIR changes the default directory or folder on the current drive.

Description

The CHDIR statement changes the default directory location, but does not change the default drive position. For example, if the default drive is C, the following statement will change the default directory on the drive D, but C is still the default drive:

CHDIR "D: / TMP"

ChDRIVE statement

Change the current drive.

grammar

ChDRIVE DRIVE

The necessary Drive parameters are a string expression that specifies an existing drive. If the zero length string ("") is used, the current drive will not change. If there are multiple characters in the DRIVE parameter, ChDrive will only use the first letter.

CLOSE statement

Turn off the input / output (I / O) file opened by the Open statement.

grammar

Close [filenumberlist]

Optional filenumberlist parameters are one or more file numbers, where filenumber is any valid file number, the syntax is as follows:

[[#] filenumber] [, [#] filenumber]..

Description

If FileNumberList is omitted, all active files open open will be turned off.

When turning off the Output or APPEND file, the final output buffer belonging to this file is written to the operating system buffer. All buffers space associated with this file are released.

When performing a Close statement, the association between the file and its file number will end.

Const statement

The declaration is used to replace the amount of text.

grammar

[Public | private] const constname [as type] = expression

The syntax of the const statement contains the following:

Partially describes public options. This keyword is used to declare constants that can be used in all processes in all modules. Can not be used during the process. Private is optional. This keyword is used to only use constants that can only be used in modules that contain this declaration. Can't be used during the process. Constname must be. The name of the constant; compliance with the standard variable naming convention. Type is optional. The data type of constant; can be byte, Boole, Integer, long, currency, single, double, decimal (currently not supported), Date, String or Variant. Each variable declared uses a separate AS type clause. Expression is required. Text, other constants, or any combination of arithmetic operators other than IS and logical operators. Description

In the default, constants are private. The constant in the process is always private; their visibility cannot be changed. In standard modules, the default value of the modular constant visibility can be changed by the public key. However, in class modules, constants can only be private, and their visibility cannot be changed with public keywords.

In order to declare a number of constants in a row, you can separate each constant to assign each constant. When using this method to declare a constant, if a public or private keyword is used, the keyword is valid for all constants in the line.

In an expression assigned to a constant, the variable, user-defined function, or the internal function of Visual Basic (such as CHR) cannot be used.

Note that constants can make the program more readable, and easy to modify. When the program is running, the constant is not unintentionally changed like a variable.

If the AS Type clause is not explicitly used in the declaration constant, the data type of the constant is the data type that is best suited for its expression.

The constants declared during SUB, FUNCTION or Property are local constants of the process. The constant declared outside the process is defined in the module containing the declaration. A constant can be used in places where you can use expressions.

Date statement

Set the current system date.

grammar

Date = DATE

For systems running Microsoft Windows 95, the Date to be set must be between January 1, 1980 and between December 31, 2099. For systems running Microsoft Windows NT, Date must be between January 1, 2079 to December 31, 2079 from January 1, 2079.

DECLARE statement

Used to declare references to the dynamic link library (DLL) in the module level.

Syntax 1

[Public | private] declare sub name lib "libname" [alias "aliaasname"] [([arglist])]

Grammar 2

[Public | private] declare function name lib "libname" [alias "aliasname"] [([arglist])] [As Type]

The syntax of the DECLARE statement contains the following sections:

Partially describes public options. The process used to declare all other processes in all modules can be used. Private is optional. The process used to declare only the process used in the module that contains the declaration. Sub is optional (but both of the SUB or FUNCTION). Indicates that the process has no return value. Function is optional (but both of the SUB or FUNCTION). Indicates that the process returns a value that can be used for expressions. Name must be. Any legal process name. Pay attention to the entry of the dynamic link library (entry point) case-sensitive. LIB must be required. Indicates a dynamic link or code resource containing the declared process. All statements require a lib clause. Libname must be required. Contains the declared process dynamic link library name or code resource name. Alias ​​is optional. Indicates that there is another name that will be called in the dynamic link library (DLL). This parameter can be used when the external process name is renamed with a keyword. Alias ​​can also be used when the process of dynamic link libraries is the same as common variables in the same range, constant or any other process. Alias ​​can be used if a character in the dynamic link library does not meet the naming convention of the dynamic link library. AliasName is optional. Dynamic links or process names in the code resource. If the first character is not a numeric symbol (#), AliasName is the name at the entrance to the process in the dynamic link library. If the first character is (#), then the subsequent characters must specify the sequence number at the entrance to the process. Arglist is optional. A variable table that represents the parameters that needs to be passed when calling the process. Type is optional. Function process returns the data type of the value; can be Byte, Boole, Integer, Long, Currency, Single, Double, DECIMAL (not supported), Date, String (support only) or variant, user-defined type, or object Types of. The syntax of the arglist parameter and the various parts of the grammatical are as follows:

[Optional] [Byval | Byref] [paramarray] varname [()] [as type]

Some describe Optional optional. Indicates that the parameters are not required. If you use this option, subsequent parameters in Arglist must be optional and must be declared using an Optional keyword. If paramarray is used, any parameters cannot use Optional. Byval is optional. Indicates that the parameter is passed by value. Byref indicates that the parameter is passed by address. Byref is the default option for Visual Basic. Paramarray is optional. Only the last parameters of Arglist, indicating that the last parameter is an array of Optional of a Variant element. You can provide any number of parameters using the ParamarRay keyword. Paramarray keywords cannot be used with ByVal, Byref or Optional. Varname must be required. A variable name that represents the parameters passing to the process; follow the standard variable naming convention. () The array variable is required. Indicates that VarName is an array. Type is optional. The data type of the parameters passing to the process; can be Byte, Boolean, Integer, Long, Currency, Single, Double, Decimal (not yet supported), Date, String (only supports growing), Object, Variant, users Type or object type defined.

Description

For the Function process, the data type of the process determines the data type of its return value. You can use the AS clause to specify the data type of the function return value after ArgList. In Arglist, an AS clause can be used to specify the data type of any parameter transmitted to the process. Not only can be specified as any standard data type, and AS ANY can also be specified in ArgList to disable type checks, allowing any data type to be passed to the process. Empty brackets indicate that the SUB or FUNCTION process does not have a parameters, and Visual Basic should ensure that no parameters are delivered. In the example below, FIRST does not bring any parameters. If you use parameters in the call to First, an error is generated:

Declare Sub First Lib "MYLIB" ()

If the parameter table is tested, the number and type of the parameters are checked each time the process is called. In the example below, first has a long parameter:

Declare Sub First Lib "MYLIB" (X as long)

Note that you cannot have a string in the parameter table of the DECLARE statement; only the length of the string can pass to the process. The string of the fixed length can be used as a process parameter, but it is converted to a growing string before passing.

Note that when the external process of the call requires a string of 0, the VBNullString constant is used. This constant is different from the zero length string ("").

DEFTYPE statement

At the module level, set the default data type for the parameters of the variable and pass to the default data type, and the FUNCTION and the Property GET process started at the beginning of the specified character.

grammar

DEFBOOL LetterRange [, LetterRange].

DEFBYTELETERRANGE [, LetterRange].

Defint LetterRange [, LetterRange].

DEFLNG LetterRange [, LetterRange].

Defcur letterRange [, LetterRange].

DEFSNG LetterRange [, LetterRange].

DEFDBL LetterRange [, LetterRange]..

Defdec letterRange [, LetterRange].

Defdate letterRange [, letterRange].

Defstr letterRange [, letterrange].

Defobj letterRange [, letterrange].

Defvar letterRange [, LetterRange].

The required LetterRange parameters follow the following syntax:

Letter1 [-Letter2]

The Letter1 and Letter2 parameters specify the name range of the default data type. Each parameter refers to the first letters of variables, parameters, and function names, or Property GET process names, and parameters can be any letter in alphabets. Not distinguishes on the case in LetterRange.

Description

The name of the statement determines the corresponding data type:

Statement Data Type DefBool BooletetebytedefintintegerDeflnglongDefcurcurrencydefsngsingledefdbldoublededefdecdecimal (Not supported) DefdatedateDefStringDefobjobjectDefvarvariant

For example, in the following block, Message is a string variable: Defstr A-Q

.

Message = "Out of Stack Space."

The DEFTYPE statement is only valid in the module of this statement. For example, the defint statement in a module is only valid for the default data type of the variables declared in the module, and the type of the return value of the Function and the Property Get process; and the variables, parameters in other modules. And the default data type of the return value is not affected. If you don't explicitly declare, all variables, parameters, function processes, and default data types of the Property GET process are Variant.

When specifying the character range, the data type is typically defined in a variable starting in the first 128 characters of the character set. However, if the specified character range is A-Z, all variables, including the default type of variables starting with international characters in the character set (128-255), are set to the specified type.

After the A-Z range is specified, the DEFTYPE statement cannot be used to redefine the variables of any sub-range. After specifying a range, if another DEFTYPE statement defines the previously defined characters, an error is generated. However, regardless of whether the variable has been defined, the DIM statement with the AS TYPE clause can be used to explicitly specify its data type. For example, you can use the following code to use the following code to define a variable of the INTEGER for the following code as Double:

Defint A-Z

DIM TaxRate As Double

The DEFTYPE statement has no effect on the elements in the user-defined type because these elements must be explicitly declared.

DELETESETTING statement

In the Windows Registry, delete the area or registry key from the application project.

grammar

DELETESETING Appname, Section [, Key]

The syntax of the deleteSetting statement has the following naming parameters:

Partially describes AppName necessary. String expressions, names, regions, or registry keys containing applications or projects are used for these applications or projects. Section is necessary. String expressions containing the area name to delete the registry key settings. If only AppName and Section, the specified area is deleted along with all related registry key settings. Key is optional. String expressions, contain registry entries to be deleted.

Description

If all parameters are provided, delete the specified registry key settings. If you try to use the DELATESETTITING statement on the existing area or registry key, a runtime error occurs.

DIM statement

Declare variables and allocate storage space.

grammar

DIM [WitHevents] Varname [([subscripts])] [as [new] type] [([witHevents] varname [([subscripts])] [AS [new] type]].

The syntax of the DIM statement includes the following sections:

Some describe WitHevents optional. Keywords, indicating that varName is an object variable used to respond to events triggered by the ActiveX object. Only in class modules is legal. With WitHevents, you can declare any single variable, but you cannot create an array using WitHevents. NEW and WITHEVENTS cannot be used together. Varname must be required. The name of the variable; follow the standard variable naming convention. Subscripts is optional. Dimensional number of array variables; up to 60-dimensional multi-dimensional arrays. Subscripts parameters Use the following syntax: [Lower to] Upper [, [Lower to] Upper].. If you do not explicitly specify Lower, the lower bound of array is controlled by Option Base statement. If there is no Option Base statement, the lower bound is 0. NEW is optional. The keywords for implicitly create objects. If you use NEW to declare an object variable, the instance of the object will be created when the variable is first referenced, so it is not necessary to use the SET statement to assign the object reference. The new keyword cannot declare any internal data type variables, as well as the instance of the slave object, and cannot be used with WitHevents. Type is optional. Variable data types; can be Byte, Boole, Integer, Long, Currency, Single, Double, DECIMAL (not supported), Date, String, String * Length (pair Strings), Object, Variant, user-defined type, or object type. Each variable declares must have a separate AS TYPE clause. Description

The variables declared in the module level are available for all the processes in the module. The variables declared in the process level are only available during the process.

The data type of the variable can be declared in the module level or process grade using the DIM statement. For example, the following statement declares a variable of an Integer type.

DIM Numberofemployees as in

You can also use the DIM statement to declare the object type of the variable. The following statement declares a variable for the new instance of the worksheet.

DIM X as new worksheet

If you do not use the NEW keyword when the object variable is defined, you must use the SET statement to assign the variable of the reference object to an existing object. Before this variable is assigned, the declared object variable has a specific value Nothing, which indicates that the variable does not point to any object instance.

You can also define a dynamic array using a DIM statement with empty parentheses. After defining a dynamic array, the REDIM statement can be used within the process to define the dimensions and elements of the array. An error occurs if you try to redefine a dimension of the dimensions that define the dimensions of the array of arrays in the private, public or DIM statements.

If you do not specify a data type or object type, and there is no DEFTYPE statement in the module, the variable is a Variant type by default.

When the variable is initialized, the numerical variable is initialized to zero, the growing string is initialized to a zero-length string ("), while the length of the string is filld by 0. Variant variable is initialized to EMPTY. Each element of the user's custom type variable is initialized as the respective independent variables.

Note When the DIM statement is used during the process, the DIM statement is usually placed at the beginning of the process.

DO ... loop statement

When the condition is True, or until the condition changes to True, the command in a statement block is repeated.

grammar

Do [{while | until} Condition] [Statements] [exit do] [statements]

Loop

Or you can use the following syntax: do [statements] [exit do] [statements]

Loop [{while | unsil} condition]

The syntax of the Do LOOP statement has the following parts:

Some describe the Condition optional parameters. Numerical expressions or string expressions are TRUE or FALSE. If the condition is null, Condition will be treated as false. Statements one or more commands that will be repeated or until Condition is True.

Description

In do ... loop, you can place any number of exit DO statements at any location, and you can jump out of the DO ... Loop loop at any time. Exit do is usually used after conditional judgment, such as if Then, in which case the exit DO statement transfers control to the statement immediately after the LOOP command.

If EXIT DO is used in a nested DO ... LOOP statement, the Exit Do will transfer control to the outer loop of the Exit DO.

END statement

End a process or block.

grammar

End

END FUNCTION

END IF

End Property

End SELECT

End Sub

End Type

End with

The syntax of the END statement has the following forms:

The statement describes the end stop execution. It is not necessary, it can be turned off in any position during the process, and the file open in the Open statement is turned off and the variable is cleared. End function is necessary for ending a function statement. END IF is necessary for ending an IF ... Then ... ELSE block. End Property is necessary for ending a Property LET, Property Get, or a Property Set process. End select, used to end a SELECT CASE statement. End Sub is necessary for ending a SUB statement. End Type is necessary to end a definition of a user-defined type (TYPE statement). End with is necessary for ending a with statement.

Description

When executed, the End statement resets all module level variables and static partial variables for all modules. To retain the values ​​of these variables, change to use the STOP statement, you can resume execution on the basis of retaining these variable values.

Note that both the END statement does not call unload, queryunload, or Terminate event or any other Visual Basic code, just the hardware termination code execution. Unload, queryunload, and terminate event code in the form and class module are not executed. The object created by the class module is destroyed, and the file opened by the Open statement is turned off, and the memory occupied by the program is released. Other programs are invalid.

The END statement provides a method of forced aborting procedures. The Visual Basic program ends normal end should uninstall all forms. As long as there is no other program to reference the object created by the program public class module, the program will be turned off immediately.

ENUM statement

Define enumeration types.

grammar

[Public | private] enum name

Membername [= constantExpression]

Membername [= constantExpression]

.

END ENUM

The ENUM statement contains the following sections:

Partially describes public options. Indicates that the Enum type is visible throughout the project. The default situation of the Enum type is public. Private is optional. Indicates that the Enum type is only visible only in the declared module. Name must be. The name of the enum type. Name must be a legitimate Visual Basic identifier that specifies the type with this name when defining a variable or parameter of the enum type. MEMBERNAME is required. A legitimate Visual Basic identifier for specifying the constituent element name of the enum type. Constantexpression is optional. The value of the element (for long type). Can be an other ENUM type. If there is no ConstantExpression, the value is given or 0 (if the element is the first memory), or the value is larger than its direct forward. Description

The so-called enumeration variable refers to the variable defined with the enum type. Variables and parameters can be defined as an ENUM type. Elements in the ENUM type are initialized to the constant value specified in the ENUM statement. The value given can include positive and negative numbers, and cannot be changed at runtime. E.g:

ENUM SecurityLevel

Illegalent = -1

SecurityLevel1 = 0

SecurityLevel2 = 1

END ENUM

The Enum statement can only appear in the module level. Once you define the ENUM type, you can use it to define variables, parameters, or return to this type. You cannot use the module name to limit the enum type. The PUBLIC ENUM type in the class module is not a member of the class; but they are also written to the type library. The ENUM type defined in the standard module is not written in the type library. Public enorm types with the same name cannot be defined in a standard module, and are defined in class modules because they share the same namespace. If there are two eNUM types in different types of libraries, the membership of this type of variable will depend on which type library has a higher reference priority.

Enum types cannot be used as the target in the With block.

ERASE statement

Reinitialize the elements of the magnitude fixed array, and release the storage space of the dynamic array.

grammar

ERASE arraylist

The required ArrayList parameter is one or more array variables that need to be cleared by a comma.

Description

ERASE takes a completely different behavior based on the fixed size (conventional) array or a dynamic array. ERASE does not need to recover memory for array of fixed size. ERASE Press the table to set the elements of the fixed array:

The influence of the array type ERASE on fixed array elements The fixed value array sets each element to 0. The fixed string array (length variable) sets each element as a zero length string (""). The fixed string array (length fixed) sets each element to 0. Fixed Variant arrays Set each element to EMPTY. The array of user-defined types sets each element as a separate variable. The object array sets each element as a specific value Nothing.

ERASE releases the memory used by the dynamic array. The program must use the RedIm statement to redefine the dimension of the array variable before the next reference.

Error statement

Analog incorrections.

grammar

Error ErrorNumber

The necessary ErrorNumber can be any valid error number.

Description

The support for ERROR statements is backward compatible. In the new code, especially when the object is established, the RAISE method of ERR object is used to generate runtime errors.

If ErrorNumber has been defined, then after the attribute of the ERR object is given the following value, the ERROR statement calls the error handler:

The property value Number is specified to the value of the ERROR statement as the parameter. Can be any valid error number. Source The name of the current Visual Basic project. Description string expressions, if this string exists, the expression will match the return value of the Error function, the return value is the return value of the Error function to the specified Number. If this string does not exist, the Description contains a string ("") of length zero. HelpFilevisual Basic Help File's Complete Limited Drive, Path, and File Name. HelpContext For the Visual Basic Help file context ID specified by an error consistent with the Number property. Lastdllerror zero. If there is no error handler, or if you do not do any start operation, an error message is issued by the ERR object property and the error message is displayed.

Note that not all Visual Basic primary applications can establish an object. Please refer to the documentation of the host application to determine whether it can create classes and objects.

EVENT statement

Define user-defined events.

grammar

[Public] Event procedureName [(arglist)]

The EVENT statement contains the following sections:

Partially describes public options. Specifies that the Event is visible throughout the project. By default, the Events type is public. It should be noted that the event can only be generated in the declared module. ProcedureName must be required. The name of the event; following the standard variable naming convention.

The syntax and grammar of the arglist parameter is as follows:

[Byval | Byref] Varname [()] [As Type]

Partial description Byval is optional. This parameter is transmitted by value. Byref is optional. Indicates that the parameter is passed by address. BYREF is the default setting of Visual Basic. Varname must be required. Represents the name of the parameter variable to be passed to the process; follow the standard variable naming convention. Type is optional. Refers to the data type of the parameter passing to the process; can be byte, Boole, Integer, long, currency, single, double, decimal (currently not supported), Date, String (support only), Object, Variant, user definition Type or object type.

Description

After the event is declared, you can use the RaiseEvent statement to generate this event. If an EVENT declaration occurs in a standard module, a syntax error will occur. Unable to declare events with return values. In the following code segment, a typical events for declaration events and events are given:

'Declare an event in the module level of the class module

Event logOncompleted (username as string)

Sub

RaiseEvent Logoncompleted ("Antoinejan")

End Sub

Note that you can declare the parameters of the event like the parameters of the declaration process, but there is a difference: the event does not have a naming parameter, optional parameter, or Paramarray parameter. The event has no return value.

EXIT statement

Exit DO ... LOOP, For ... NEXT, FUNCTION, SUB or Property code blocks.

grammar

Exit do

EXIT for

EXIT FUNCTION

EXIT PROPERTY

EXIT SUB

The syntax of the exit statement has the following forms:

The statement describes that exit do provides a method of exiting the DO ... LOOP loop and can only be used in the DO ... Loop loop. The Exit Do will transfer control to the statement after the Loop statement. When Exit Do is used in nested DO ... Loop loops, Exit Do will transfer control to the outer loop of the exit DO location. Exit for provides a method of exiting the For loop and can only be used in For ... next or for each ... next loop. Exit for transfers control to NEXT. When the exit for is used in the nested for loop, the exit for transfers control to the outer cycle of the location of the Exit for. The exit function is immediately exited from the function of the present state. The program continues to execute from the statement after calling the Function statement. EXIT Property is immediately exited from the pro process included in the statement. The program continues to execute from the statement after calling the statement of the Property process. EXIT SUB is immediately exited from the SUB containing the statement. The program continues to execute from the statement after calling the SUB process. Description

Don't mix the EXIT statement with the end statement. EXIT does not indicate the termination of a structure.

FILECOPY statement

Copy a file.

grammar

FILECOPY SOURCE, DESTINATION

The syntax of the FILECOPY statement contains the following name parameters:

Some describe the necessary parameters. String expressions, used to indicate the file name to be copied. Source can contain directories or folders, and drives. Destination necessary parameters. String expressions for specifying the optimal file name to be copied. Destination can contain directories or folders, and drives.

Description

If you want to use a filecopy statement to an open file, an error will occur.

For Each ... Next statement

Repeat a group of statements for each element in a array or collection.

grammar

For Each Element in group [statements] [exit for] [statements]

Next [Element]

The syntax of the for ... EACH ... NEXT statement has the following parts:

Partially describes the ELEMENT necessary parameters. The variables used to traverse all elements in the collection or array. For collection, Element may be a Variant variable, a general object variable or any special object variable. For arrays, Element can only be a Variant variable. Group of necessary parameters. Object Collection or Array Name (except for the array of user-defined types). Statements optional parameters, one or more statements performed in each item in Group.

Description

If there is at least one element in the collection, it will enter for ... EACH block execution. Once entering the loop, you will perform all the statements in the cycle for the first element in Group. If there are other elements in Group, the statement in the loop is performed. When all elements in Group are executed, they will exit the loop, and then proceed from the statement after the next statement.

You can place any exit for statement at any location in the loop, and you can exit the loop at any time. Exit for is often used after conditional judgment, such as if Then, and transfers control to the statement immediately after NEXT.

A For ... EACH ... Next loop is looped into the other to form a nested for ... EACH ... NEXT loop. But each looped ELEMENT must be unique.

Note If the Element in the NEXT statement is omitted, it is performed as when ELEMENT is present. If the next statement appears before it corresponds to the FOR statement, it will generate an error.

You cannot use a user-defined type array in the for ... EACH ... NEXT statement because Variant does not include a user-defined type. For ... NEXT statement

Repeat a group of statements with a specified number of times.

grammar

For counter = start to end [step step] [statements] [exit for] [statements]

Next [counter]

The syntax of the for ... NEXT statement has the following parts:

Partially describe the necessary parameters. Use the numerical variables of the loop counter. This variable cannot be a Boolean or array element. START necessary parameters. The initial value of Counter. END Essential parameters, the final value of the Counter. STEP Optional parameters. Counter's step. If not specified, the default value of STEP is 1. STATEMENTS optional parameters. One or more statements placed between For and NEXT, they will be executed.

Description

The STEP parameter can be a positive or negative number. The STEP parameter value determines the execution of the loop, as shown below:

Value loop execution, if positive or 0counter <= end negative counter> = End

When the statements in all loops are executed, the STEP's value will be added to the Counter. At this point, the statement in the loop may be executed again (the same test based on cyclic start execution) may also be exit loop and proceed from the NEXT statement.

Tip Change the value of Counter in the loop will make the program code reading and commissioning more difficult.

Any exit for statement can be placed in any location and exits the loop at any time. Exit for is often used after conditional judgment, such as if ... then, and transfers control to the statement immediately after NEXT.

A For ... next loop can be placed in another for ... next loop, constitutes a nested loop. However, in each cycle is to use different variable names. The following architecture is correct:

FOR i = 1 to 10

For j = 1 to 10

Fork = 1 to 10

...

Next K

NEXT J

Next i

Note If the Counter in the next statement is omitted, it is performed as when Counter is present. But if the NEXT statement appears before it corresponds to the FOR statement, it will generate an error.

FUNCTION statement

Declare the name, parameters, and code constituting its main body.

grammar

[Public | private | friend] [static] function name [(arglist)] [as type] [statements] [name = expression] [exit function] [statements] [name = expression]

END FUNCTION

The syntax of the function statement includes the following sections:

Partially describes public options. It means that all other processes of all modules can access this Function process. If used in a module containing Option Private, this process is not available outside the project. Private is optional. Indicates that only other processes of modules containing their declarations can access the Function process. Friend is optional. Can only be used in class modules. It is visible throughout the project, but the controller of the object instance is invisible. Static is optional. Indicates that the local variable value of the function process will be retained between the call. The Static property does not affect the variables of the Function declaration, even if these variables are used during the process. Name must be. Function name; follow standard variable naming conventions. Arglist is optional. Represents a list of parameter variables to pass to the function process during the call. Multiple variables are attached to the comma. Type is optional. The data type of the return value of the function process can be byte, Boole, Integer, long, currency, single, double, decimal, Date, String, Object, Variant, or any user-defined type. . Statements is optional. Any statement group executed during the function process. Expression is optional. The return value of function. The grammar of the arglist parameters and the various parts of the grammatical are as follows:

[Optional] [Byval | Byref] [paramarray] varname [()] [as type] [= defaultValue]

Some describe Optional optional. Indicates that the parameters are not required. If this option is used, the subsequent parameters in ArgList must be optional and must be declared using an Optional keyword. If you use Paramarray, any parameters cannot be declared using an Optional statement. Byval is optional. Indicates that the parameter is passed by value. Byref is optional. Indicates that the parameter is passed by address. Byref is the default option for Visual Basic. Paramarray is optional. Only for the last parameters of Arglist, indicating that the last parameter is an Optional array of a Variant element. You can provide any number of parameters using the ParamarRay keyword. ParamarRay keywords cannot be used with ByVal, Byref, or Optional. Varname must be required. Represents the name of the variable of the parameters; follow the standard variable naming convention. Type is optional. Data types passing to the parameters of the process; can be Byte, Boolean, Integer, Long, Currency, Single, Double, Decimal (not supported), Date, String, Object or Variant. If the parameter is not Optional, it can also be a user-defined type, or an object type. DEFAULTVALUE is optional. Any constant or constant expression. It is legal only for Optional parameters. If the type is Object, the explicit default value can only be Nothing.

Description

If you do not use public, private, or Friend explicitly specified, the Function process is default. If STIC is not used, the value of the local variable will not be retained after the call. Friend keyword can only be used in class modules. But the Friend process can be accessed by the process of any module of the project. The Friend process does not appear in the type library of its parent class, and the Friend process cannot be bound by later.

Note that the Function process can be recursive; that is, the process can call yourself to complete a particular task. However, recursive may cause the stack overflow. Usually static keywords and recursive Function processes are not used together. All executable code must belong to a process. You cannot define the Function process during another Function, Sub or Property.

The exit function statement makes the execution immediately exits from a function process. The program is then executed from the statement after calling the state of the function process. An exit function statement can be available in any location in the Function process.

The Function process is similar to the SUB process is that the Function process is an independent process that can obtain parameters, perform a series of statements, and changing its parameter values, and the sub-process is: When the return value of the function is to be used You can use the function process in the right side of the expression, which is the same as the internal function, such as SQR, COS or CHR.

In the expression, a Function process can be called by using a function name and a corresponding parameter list is given by parentheses. See the CALL statement for details on how to call the Function process.

To return a value from a function, just assign the value to the function name. This assignment can occur in any location of the process. If no value is assigned to the NAME, the process will return a default value: the value function returns 0, the string function returns a zero-length string ("), and the Variant function returns EMPTY. If the object reference is not assigned to Name during the FUNCTION reference to the object reference, the function returns Nothing.

The following example illustrates how to return a value to a function called binarysearch. In this example, false gives the function name, indicating that a certain value is not found.

Function binarysearch (...) AS Boolean

.

The value is not found, returns a FALSE value.

IF Lower> Upper Tan

Binarysearch = FALSE

EXIT FUNCTION

END IF

.

END FUNCTION

The variables used in the function process are divided into two categories: one is explicitly declared during the process, and the other is not. The variable (DIM or equivalent method using DIM or equivalent) in the process is partial variable. For variables that are not explicitly declared during the process, it is also partially local unless they have a higher level in the process.

Note The process can use variables that are explicitly declared within the process, but as long as there is any name defined in the module level, the name conflict will be generated. If the undemented variables used in the process are identical to another process, constant, or variables, it is considered that the process is used is the name of the module level. Explicit statement variables can avoid such conflicts. You can use an OPTION Explicit statement to force explicitly declared variables.

Note that Visual Basic may rearrange mathematical expressions to increase internal efficiency. If the Function process changes the value of a variable in a mathematical expression, it should be avoided in this expression.

Get statement

Read an open disk file into a variable.

grammar

Get [#] filenumber, [recnumber], varname

The syntax of the GET statement has the following parts:

Partial description filenumber is necessary. Any valid file number. Recnumber is optional. Variant (long). The record number (file file) or the number of bytes (the file of the binary method), in indicating that the data is started here. Varname is necessary. A valid variable name, put the read data into it. Description

The data read from the GET is usually written to a file with PUT.

The first record or byte in the file is located in position 1, the second record or byte is located at position 2, and so on. If RECNUMBER is omitted, the next record or byte following the previous GET or PUT statement (or reading the last Seek function indicating) is read. All commas for the boundary must be listed, for example:

Get # 4, FileBuffer

The following rules apply to files that open in Random:

If the length of the data to be read is less than the length specified in the LEN clause of the Open statement, the GET reads the subsequent record within a certain boundary, where the length of the boundary is equal to the length of the record. The existing content in this file buffer is filled into a space, and the space is between the end of the recording and the beginning of the next record. Since the amount of data fills cannot be determined, it should be tried to make the length of the record with the length of the read data, which is usually a good way. If the read variable is a variable length string, the GET statement first reads a double-byte descriptor containing the string length and then reads the data in the discharge variable. Therefore, the recording length specified by the LEN clause in the Open statement must be at least two bytes more than the actual length of the string. If the read variable is a value type of Variant, GET reads two bytes to identify VARIANT's VARTYPE, and then read the data in this variable. For example, when reading VARIANT of VARTYPE 3, the GET reads six bytes: the first two bytes Description Variant is VARTYPE 3 (long), and the last four bytes contain long type data. The recording length specified by the LEN clause in the Open statement must be at least two bytes more than the actual length required for the storage variable. Note You can read a Variant array from the disk using a GET statement, but you cannot use it to read the scalar Variant containing the array. You cannot read the object from the disk using GET. If the read variable is VARTYPE 8 (String) Variant, the GET reads two bytes, identifying Vartype, and the next two bytes indicate the length of the string, then read strings data. The recording length specified by the LEN clause in the Open statement must be more than four bytes than the length of the actual string. If the read variable is a dynamic array, the GET reads a descriptor whose length is equal to 2 plus 8 multiplying the dimension, ie 2 8 * Numberofdimensions. The read array data and array descriptors need to occupy bytes, while the recording length specified by the LEN clause in the Open statement must be greater than or equal to the sum of these bytes. For example, when writing an array to a disk, the following array declaration requires 118 bytes: DIM MyArray (1 to 5, 1 to 10) AS Integer

The 118-byte allocation is as follows: 18 bytes are used for descriptors (2 8 * 2), 100 bytes for data (5 * 10 * 2). If the read variable is a size fixed array, GET reads only the data. It does not read the descriptor. If the read variable is any other type of variable (not a variable length string or variant =, the get read only the variable data. The record length specified by the LEN clause in the Lenn statement must be greater than or equal to reading The length of the data. GET When reading the element of the user-defined type, it seems that each element is read separately, but is not filling between the elements. On the disk, (written with PUT) user-defined The type of dynamic array has a descriptor with a length equal to 2 plus 8 multiplying a dimension, that is, the record length specified by the LEN clause in the 2 8 * numberofdimensions.open statement must be greater than or equal to reading individual elements ( The total number of bytes required for any array and its descriptive is. For files opened in binary, all rules of Random apply, except: except:

When the LEN clause in the Open statement does not work, GET reads all variables from the disk; that is, there is no fill between the two records. For any array that is not a user-defined type, GET reads only the data. It does not read a descriptor. The GET reads the variable length string, regardless of whether these strings have a descriptor with a length of 2 bytes, which are not an element defined type of type. The number of bytes read is equal to the number of characters already included in the string. For example, the following statement reads ten bytes from the file number 1 file: varstring = String (10,)

Get # 1, Varstring

Gosub ... Return statement

Skating in another subroutine during a process, then returning.

grammar

Gosub Line ... line ...

Return

The necessary LINE parameters can be any row tag or line number.

Description

Gosub and Return can be used anywhere in the process, but Gosub and corresponding RETURN statements must be placed in the same process. A subroutine can contain more than one RETURN statement, but when the first return statement is encountered, the program returns to the statement following the GOSUB statement just executed.

Note You cannot use Gosub ... Return to enter or exit the SUB process.

Tip Create a separate process and use Gosub ... Return to call, you can make the program more structured.

GOTO statement

Unconditionally transferred to the line specified during the process.

grammar

Goto Line

The necessary LINE parameters can be any row tag or line number.

Description

GOTO can only jump to the row in it.

Pay attention to too many GOTO statements that make the program code are not easy to read and debug. Use structured control statements as much as possible (Do ... Loop, For ... next, if ... the ... else, select case).

If ... then ... ELSE statement

A set of statements are performed based on the value of the expression.

grammar

If Condition Then [Statements] [Else ElseStatements]

Alternatively, you can use the grammar of the block:

If Condition Then [Statements]

[Elseif Condition-n Then [ElseifStatements] ...

[Else [elsestatements]]]

END IF

If ... The syntax of the ELSE statement has the following sections:

Partially describe the necessary parameters. One or more types of expressions with the following: numerical expressions or string expressions, their operation results are TRUE or FALSE. If condition is null, Condition will be considered False. TypeOf ObjectName Is ObjectType forms of expressions. Where ObjectName is a reference to any object, and ObjectType is any valid object type. If ObjectName is an object type specified by ObjectType, the expression is true, otherwise false. Statements is an optional parameter in the block form; however, in a single line, and if there is no ELSE clause, it is a necessary parameter. One or more statements are separated by colon, they are executed when constructing is TRUE. Condition-n optional parameters. Same as Condition. ElseifStatements optional parameters. One or more statements, they are executed when the associated Condition-N is TRUE. ElseStatements optional parameters. One or more statements, they do not execute when the Condition or Condition-n is True in front. Description

Short simple tests can be made using a single line form (first syntax). However, block form (second syntax) provides stronger structured and adaptability, and is usually easier to read, maintained and debugged.

Note In a single line, multiple statements can also be performed in accordance with the result of the if ... then judgment. All statements must be on the same row and are separated by colons, as shown in the following statement:

IF a> 10 THEN A = A 1: B = B A: C = C B

In block form, the IF statement must be a first line statement. The else, elseif, and end IF parts can only be added to the line number or row tag. The IF block must end with an END IF statement.

To determine if a statement is an IF block, you can check what the THEN keyword is checked. If there are other non-oscillated contents after the same line of THEN, this statement is the unlimited IF statement.

ELSE and Elseif classes are optional. In the IF block, you can place any plurality of ElseiF clauses, but must be before the else clause. The IF block can also be nested.

When the program is running to an IF block (second syntax), Condition will be tested. If condition is true, the statement after then will be executed. If condition is false, the conditional pattern of each elseif section will be calculated and tested. If you find a condition for True, it will be executed immediately after the relevant THEN. If there is no Elseif condition type true (or there is no elseif clause), the program executes the statement of the ELSE section. After executing the statement after the THEN or ELSE, will continue to be executed from the statement after the END IF.

Tip When performing a variety of possible actions based on a single expression, SELECT CASE is more useful. However, the TypeOf ObjectName Is ObjectType clause cannot be used in the SELECT CASE statement.

Note TypeOf cannot be used with fixed data types such as long, integer, and other not Object.

IMPLEMENTS statement

Specifies the interface or class to be implemented in the class module that contains the statement.

grammar

Implements [InterfaceName | Class]

The required InterfaceName or Class is the name of the interface or class in the type library, which is implemented with methods consistent with the Visual Basic class.

Description

The so-called interface is the original set of prototypes (methods, and attributes) representing the interface package; that is, it only contains the declaration of the membership process. One class provides all methods and properties of one or more interfaces. Each time the controller is called each time the function is called, the code executed by the class is provided by the class. Each class should at least implement a default interface. In Visual Basic, any member who has no explicit declaration in an implementation interface is an implicit member of the default interface.

When the Visual Basic class implements the interface, all public processes are provided in the type library of the interface. In addition to providing mapping relationships between interface prototypes and self-editing procedures, the imports statement also makes this class to COM QueryInterface calls for the specified interface ID.

Note that Visual Basic cannot achieve derived classes or interfaces.

When an interface or class is implemented, the PUBLIC procedure used is included. If a member is missing when an interface or class is implemented, an error will occur. If a process in a class is not there yet, an appropriate error message can be generated (const e_notimpl = & h80004001) so that the user is aware that the member is not implemented.

The Implements statement cannot be used in a standard module.

INPUT # statement

Read the data from the open order file and specify the data to the variable.

grammar

Input #filenumber, Varlist

The syntax of the Input # statement has the following sections:

Partial description filenumber is necessary. Any valid file number. Varlist is necessary. With a comma-bound variable list, assign values ​​read in the file to these variables; these variables are not possible to be an array or object variable. However, a variable can be used to describe an element of an array element or a user-defined type.

Description

The data written in the input # statement is usually written to the data of the INPUT # statement. This statement can only be used to open files in Input or binary.

Specify the standard string or value data directly to the variable without modification when reading data. The following table shows how to handle other input data:

Data Specify Variable Variable Variable Box or Blank Row Empty # Null # Null # True # or # false # true or false # YYYY-MM-DD HH: mm: SS # Date and / or time expressed by expressions and / or time #ERROR ErrorNumber # errorNumber (this variable is a variant, used to mark an error)

Double quotes ("") in the input data will be ignored.

The order in which the data items in the file must be the same as the order of variable in Varlist, and match variables of the same data type. If the variable is numeric type and the data is not a numeric type, the value of the specified variable is zero.

When entering a data item, if the end of the file is reached, the input is terminated and an error is generated.

Note In order to be able to read the data correctly in the variable with the Input # statement, use the WRITE # statement without using the print # statement when writing the data into the file. Using the WRITE # statement ensures that individual data domains are separated correctly.

KILL statement

Remove the file from the disk.

grammar

Kill Pathname

The necessary pathname parameters are string expressions used to specify a file name. PathName can contain directories or folders, and drives.

Description

In Microsoft Windows, KILL supports multi-character (*) and single-character (?) Wildcards to specify multiple files.

Let statement

Assign the value of the expression to the variable or attribute.

grammar

[Let] VarName = EXPRESSIONLET statement syntax includes the following:

Some describe let options. Explicit use of the LET keyword is also a format, but the keyword is usually omitted. Varname must be required. Name of variables or properties; follow standard variable naming conventions. Expression is required. Assign the value of the variable or attribute.

Description

Only when an expression is a data type compatible with a variable, the value of this expression can assign a variable or attribute. You cannot assign a value variable in a value of the string expression, nor can you assign a value of a numeric expression to a string variable. If this is done, there will be an error in the compilation time.

You can assign a VARIANT variable with a string or numerical expression, but it is not necessarily correct. Any Variant other than NULL can assign a string variable, but only when Variant's value can be interpreted as a number of values. You can use the ISNUMERIC function to confirm whether Variant can be converted to a number.

Note When a numeric expression is assigned to another value type variable, the value of the expression is converted to the numerical type of the result variable.

The Let statement can assign a variable of a record type to a variable belonging to the same user-defined type. Use the LSET statement to assign a different user-defined record variable. Use the SET statement to assign object reference to the variable.

LINE INPUT # statement

Read a row from the open order file and assign it to the String variable.

grammar

Line INPUT #filenumber, Varname

The syntax of the LINE INPUT # statement has the following sections:

Partial description filenumber is necessary. Any valid file number. Varname is necessary. Effective Variant or String variable name.

Description

The data read from the line input # statement is usually written from the file with the print.

The LINE INPUT # statement reads only a character from the file until the carriage return is encountered (chr (13)) or carriage return - the wrapper (CHR (13) CHR (10)). The Enter-the laundry will be skipped without being attached to the string.

LOCK, UNLOCK statement

For all files or part of the files you open with the Open statement, the control accesses for other processes.

grammar

LOCK [#] filenumber [, recordrange]..

UNLOCK [#] filenumber [, recordrange]

The syntax of the LOCK and UNLOCK statements has the following sections:

Partial description filenumber is necessary. Any valid file number. RecordRange is optional. To lock or unlock the record range.

Set

The setting of the RECORDRANGE parameter is as follows:

Renumber | [Start] to End

Setting the RecNumber Record number (file file) or byte number (file of binary mode), specify where to start locking or unlocking. START The first record number or byte number to lock or unlock. End The last record number or byte number to be locked or unlocked.

Description

In an environment where there are several processes accesses the same file, use the Lock and UNLOCK statement.

Both statements are always pairs when using the Lock and UNLOCK statements. The parameters of Lock and UNLOCK must be exactly the same.

The first record or byte in the file is in position 1, the second record or byte at position 2, and so on. If only one record is specified, only the record is locked or unlocked. If you specify a record within a range and omit the start recording (START), all records within this range are locked or unlocked from beginning to end (End). If you use a LOCK without RecNumber, you will lock the entire file; and Unlock without RecNumber will unlock the entire file.

If you have already opened files in order to input or output, you will affect the entire file regardless of START and END specified, Lock and Unlock will affect the entire file. WARNING Before you close a file or exit, be sure to remove all locks to the file with the Unlock statement. If you cannot delete the lock, it will produce an unexpected consequence.

Lset statement

Align a string to the left in a string variable, or copy a user-defined type variable to another user-defined type variable.

grammar

Lset stringvar = String

Lset varname1 = varname2

The syntax of the LSET statement has the following sections:

Some describe the necessary parameters for StringVar. String variable name. String necessary parameters. The string expressions of the left alignment in Stringvar. VarName1 necessary parameters. User-defined type variable name, the content will be copied. VarName2 necessary parameters. User-defined type variable name, the content will be copied.

Description

LSET will replace the StringVar in a blank character.

If String is longer than StringVar, LSET only places a few characters in StringVar, and the length is the length of StringVar.

WARNING You cannot use LSET to copy a user-defined type variable to another user-defined type variable. Copying a data type data to a space left to another data type, which may cause unpredictable results.

When copying a variable from a user Custom Type to other variables, the binary data of this variable is copied from one variable to another variable, but does not care about the data type specified by the element.

MID statement

In a variant (string) variable replaces the specified number of characters in another string.

grammar

MID (stringvar, start [, length]) = string

The syntax of the MID statement has the following sections:

Some describe the StringVar necessary parameters. Changed string variable name. START necessary parameters; Variant (long). The starting position of the character in StringVar is replaced. LENGTH Optional parameters; Variant (long). The number of characters replaced. If omitted, String will all be used. String necessary parameters. String expressions, replace the string of some StringVar.

Description

The number of characters replaced is always less than or equal to the number of stringvar.

Note that the MIDB statement acts on byte data contained in the string. In the MIDB statement, Start specifies the starting position of the byte of the StringVar, while Length is the number of bytes replaced.

MKDIR statement

Create a new directory or folder.

grammar

Mkdir Path

The necessary path parameters are string expressions for specifying the directory or folder to be created. Path can include a drive. If no drive is specified, MKDIR creates a new directory or folder on the current drive.

Name statement

Rename a file, directory, or folder.

grammar

Name Oldpathname as newpathname

The syntax of the Name statement has the following parts:

Partially describes the necessary parameters of OldPathname. String expressions, specify that existing file names and locations, can contain directories or folders, and drives. Newpathname necessary parameters. String expressions, specify new file names and locations, can contain directories or folders, and drives. The file name specified by NewPathname cannot exist.

Description

The Name statement renames the file and moves it to a different directory or folder. If necessary, the NAME can move the file across the drive. However, when NewPathName and OldPathname are in the same drive, only the existing directory or folder can be renamed. Name cannot create a new file, directory, or folder. Using Name on an open file, an error will occur. You must turn the open file before changing the name. The NAME parameter cannot include a multi-character (*) and a single-character (?) Wildcard.

ON Error statement

Start an error handler and specify the location of the subroutine in a process; or use an error handler.

grammar

ON Error Goto Line

ON Error ResMe next

ON Error Goto 0

The syntax of the ON ERROR statement can have any of the following forms:

The statement describes the ON ERROR GOTO LINE launches the error handler, and the routine begins with the LINE specified in the necessary LINE parameters. The LINE parameter can be any row tag or line number. If a runtime error occurs, the control will jump to line, activate the error handler. The specified line must be in a process, this process is the same as the on ERROR statement; otherwise the compilation time error will occur. ON Error Resume Next Description When a runtime error occurs, the control goes to the statement following the incorrect statement, and continues to run here. Use this form while accessing the object without using the ON Error Goto. ON Error Goto 0 prohibits any initiated error handler during the current process.

Description

If you don't use the on Error statement, any runtime error is fatal; that is, the result will cause display error information and abort operation.

A "Allowed" error handler is a handler that is opened by an ON Error statement; a "active" error handler is an error handler that is permitted during an error process. If an error occurs when the error handler is active (this time between an error, EXIT SUB, EXIT FUNCTION, or DXITY statement) occurs, the error handler of the current process will not process this error. The control returns the process of calling. If the calling process has a launched error handler, activate the error handler to process the error. If the error handler of the calling process is also active, the control will return to the previous calling process, so that it is done until a permitted but not an active error handler is found. If the error handler that is allowed and inactive is not found, the error itself is serious in the place where the error is actually occurring. The error handler is a current process each time the control returns the control. During any process, once the error handler handles errors, the location specified from the Resume statement is restored from the resume statement during the current process.

Note An error handler is not a sub process or a function process. It is a code with row labels or row numbers.

The error handler relies on the value in the Number property of the ERR object to determine the cause of the error. Before any other error occurs, or before calling a process that may cause an error, the error handler should test or store the relevant attribute values ​​in the ERR object. The attribute value in the ERR object reflects the recent error. Err.Description contains an error message associated with Err.Number.

ON Error Resume Next allows the program to continue execution from the statement following the incorrect statement, or continues to run from the statement that follows the process containing the ON ERROR RESUME NEXT statement. This statement can be used to set up a runtime error, so that the program can continue. The error handler can be placed in an error occurrence without having to transfer the control to other locations during the process. When calling another process, the ON ERROR RESUME NEXT statement is inactive, so if you want to perform embedding error processing in the routine, the ON ERROR RESUME NEXT statement should be performed in each called routine. Note When the error is processed during access to other objects, the ON Error Goto directive is not as used as ON Error Resume next. Deal each time and objects, check the ERR will cancel this problem when you don't know which object is used to access the code. It can be determined which object generates an error (the object specified in Err.Source), or it is also possible to determine which object is placed in Err.Number.

On Error Goto 0 stops processing an error during the current process. Even if the line is included in the process, it does not specify line 0 as the starting point of the code for processing the error. If there is no ON Error Goto 0 statement, the error handler will automatically shut down when exiting the process.

When the error has not occurred, in order to prevent the error handler code from running, as in the lower program, write the exit sub, an exit function, or an Exit Property statement in front of the error handler.

Sub InitializationMatrix (var1, var2, var3, var 4)

ON Error Goto Errorhandler

.

EXIT SUB

Errorhandler:

.

Resume next

End Sub

Here, the error handler code is after the EXIT SUB statement, and thereby separated from the process in the process. Error handler code can be written anywhere in the program.

When the object is run as a file, the unprecised error in the object is returned to the control application. In the development environment, if the correct option is set, the unprecised error only returns the control application. Please refer to the description of the document of the primary application, so that what options should be set when debugging, how to set these options and the host can create classes.

If an object access to other objects is created, you should proceed to handle the unprocessed error returned from those objects. If this error cannot be processed, use the error code in Err.Number as an error, then turn the error back to the caller of the object. The error code should be added to the VBObjectEnderRor constant to specify this error. For example, if the error code is 1052, use the following method to specify an error:

Err.Number = VBObjectError 1052

Note that the system error generated during the call dynamic link library (DLL) does not generate exceptions, nor will it be captured by the Visual Basic's error capture operation. When the DLL function is called, you should check each return value (according to the details of the API) to determine whether it is successful or failed. If it fails, check the value in the LastDLLLERR in ERR object.

On ... Gosub, on ... GOTO statement

Depending on the value of the expression, go to a particular line execution.

grammar

ON Expression Gosub DestinationList

ON Expression Goto DestinationList

ON ... GOSUB and ON ... GOTO statements The syntax of the statement has the following sections: section describes the EXPRESSION parameters. Numerical expressions, its operational results should be an integer bound between 0 and 255, including 0 and 255. If the calculation of Expression is not an integer, it will first go four into an integer. DestinationList The necessary parameters. A list of line numbers or row tags, there is a comma.

Description

The value of Expression decided which to go to DestinationList. If the value of Expression is less than 1 or greater than the number of items, the following results are generated:

If the value of the expression is equal to 0 control, the statement will be transferred to ON ... GOSUB or ON ... GOTO. The number of items greater than the string will be transferred to the statement after ON ... GOSUB or ON ... GOTO. An error occurred. Errors will occur than 255.

The line number and row tag can be mixed in the same list. Any row and row tag can also be used in ON ... GOSUB and ON ... GOTO. However, if there is too much row label or line number, it is necessary to use the "continuation" to the next row after the line is used in one line.

Tip To perform multiple branches, SELECT CASE provides a structural and adaptive method.

Open statement

Ability to input / output (I / O).

grammar

Open pathname for mode [access access] [LOCK] AS [#] filenumber [len = reclength]

The syntax of the Open statement has the following parts:

Partial description pathname is necessary. String expressions, specify file name, which may also include directories, folders and drives. Mode is necessary. Keywords, specified file mode, with append, binary, input, output, or random mode. If not specified, open the file in the Random Access. Access options. Keywords indicating that the open file can be performed, there is read, write, or read write operation. Lock is optional. Keywords, illustrate the operation of files that are limited to other processes, with Shared, Lock Read, Lock Write, and Lock Read Write operations. Filenumber is necessary. A valid file number, range between 1 and 511. Use the FreeFile function to get the next available file number. RecLength is optional. One number of less than or equal to 32, 767 (bytes). For files opened with random access, this value is the recording length. For sequential files, this value is the number of buffer characters.

Description

Before doing any I / O operations, you must open the file first. The Open statement assigns a buffer for the file for I / O, and determines the access method used in the buffer.

If the file specified by Pathname does not exist, then this file can be established when the file is opened with Append, Binary, Output, or Random.

If the file has been opened by other processes, and the specified access type is not allowed, the OPEN operation fails and there will be an error.

If Mode is a binary method, the Len clause will be ignored.

Important can open the same file with different file numbers in Binary, Input and Random mode, without having to close the file first. In the Append and Output mode, if you want to open the same file with a different file number, you must turn the file before opening the file.

OPTION BASE statement

Used in the module level to declare the default lower bounds of the array subscript. grammar

Option Base {0 | 1}

Description

Since the default setting of the lower bound is 0, there is no need to use an OPTION BASE statement. If this statement is used, you must write before all the process of the module. A module can only appear once an Option Base, and must be in front of the array declaration.

Note that the TO clause in DIM, Private, Public, RedIm, and Static statements provides a more flexible way to control the subscript of the array. However, if you do not use the TO clause explicitly specify the lower bound, you can use Option Base to set the default lower bound to 1. Use the Array function or the array created by the Paramarray keyword to 0; Option Base does not work against Array or Paramarray.

The Option Base statement only affects the lower bound of the array located in the module containing the statement.

OPTION COMPARE statement

Used in the module level, the default comparison method used to declare the string comparison.

grammar

Option Compare {binary | text | database}

Description

If you are using, the OPTION COMPARE statement must be written before all the process of the module.

The Option Compare statement is a method of specifying a string comparison (Binary, Text or Database). If there is no Option COMPARE statement in the module, the default text comparative method is binary.

Option Compare Binary is a string comparison based on the internal binary representation of characters. In Microsoft Windows, the sort order is determined by the code page. A typical binary sort order is shown in the following example:

A

Option Compare Text is compared to a string comparison based on a non-case-written text sort level determined by the system. When using Option Compare Text, the same character is sorted, the following text sorting level is generated: (a = a) <(_ = _) <(b) <(e = e) <(_ = _) < Z = z) <(_ = _)

Option Compare Database can only be used in Microsoft Access. When a string comparison is required, the sort level determined according to the country ID of the database is compared.

Option ExpliCit statement is used in the module level, forcibly explicitly declares all variables in the module. Syntax Option Explicit Description If you are using, the OPTION Explicit statement must be written before all the process of the module. If Option Explicit is used in the module, you must explicitly declare all variables using DIM, private, public, redim or static statements. If the unconformed variable name is used, there is an error in the compile time. If you do not use an Option ExpliCit statement, all unspecified variables are Variant type unless you use the DEFTYPE statement. Note Option using Option Explicit Avoid errors when typing existing variables, using this statement in the scope of the variable to avoid confusion.

Option private statements can use Option Private Module in host applications that allow reference to span multiple projects to prevent the contents of the module from outside the module. In host applications that do not allow this reference, for example, Visual Basic's independent mode, Option Private does not work. Syntax Option Private Module Description If you use an OPTION Private statement, you must be before any process written in the module level. If Option Private Module is used in the module, its common part (for example, variables, objects, objects, and user-defined types defined) are still available in the project to which the module belongs, but other applications or projects Is not available. Note that Option Private can only be used in the primary application that supports multiple projects simultaneously and allows you to use the primary application between the loaded inter-engineering references. For example, Microsoft Excel allows loading multiple projects, Option Private Module can be used to limit the visibility of cross-engineering. Although Visual Basic allows multiple projects, it is never allowed to be across engineering in Visual Basic. The Print # statement will format the displayed data write order file. Syntax print #filenumber, [outputlist] Print # statement syntax has the following sections:

Partial description filenumber is necessary. Any valid file number. OutputList is optional. Expressions or list of expressions to print. Set the settings of the OutputList parameter as follows: [{SPC (N) | Tab [(n)]}] [expression] [charpos]

Settings SPC (n) is used to insert blank characters in the output data, and n refers to the number of blank characters to be inserted. Tab (n) is used to position the insertion point on a certain absolute number, here, n is the column number. Use the non-parametric Tab to position the insertion point in the starting position of the next print area. EXPRESSION 要 数 表 表 表 表 表 表 表 表 表 表Charpos specifies the insertion point of the next character. Use the semicolon to position the insertion point after the previous display character. Use Tab (n) to position the insertion point on a certain absolute number, and position the insertion point at the beginning of the next print area with a non-parametric TAB. If Charpos is omitted, print the next character in the next line. Note data typically writes in the file with the LINE INPUT # or INPUT. If the parameter outputlist is omitted, and the filenumber has only one list separator, a blank line is printed into the file. A blank or one semicolon can be separated from a plurality of expressions. Blank and semicolon equivalent. For Boolean type data, printing True or False. No matter what country, True and False are not translated. The standard short date format that can be identifiable using the operating system can write a Date type data into the file. When the setting or time component or the settings of these components are set to zero, only the specified part is written into the file. If the data of OutputList is EMPTY, no data is written to the file. However, if the data of OutputList is NULL, the null is written to the file. For ERROR type data, the output data looks like Error ErrorCode. And in any region, you don't translate the error keyword. All data written to the file with Print # is internationally universal; that is, these data can be formatted correctly using the decimal separator. Because Print # writes the image of the data into the file, you must separate the data to be separated to print correctly. If the print position is moved to the next print zone using the non-parametric Tab, the print # also writes a blank write between the print fields. Note If you want to use the Input # statement to read the file data in the future, you should use the WRITE # statement without a print # statement to write the data to the file. Because when using WRITE #, the data domain can ensure the integrity of each data field, so you can read the data with INPUT. Using Write # can also ensure that data in any area is read correctly. The private statement is used in the module level to declare the private variable and allocate storage space. Syntax Private [WitHevents] VarName [([subscripts])] [As [new] type] [([witHevents] Varname [([subscripts])] [as [new] type]]... The syntax of the privacy includes the following section:

Some describe WitHevents optional. Keywords, indicating that VarName is an object variable used to respond to an event triggered by the ActiveX object. Only in class modules is legal. With WitHevents, you can define any single variable, but you cannot create arrays with WitHevents. NEW and WITHEVENTS cannot be used together. Varname must be required. The name of the variable; follow the standard variable naming convention. Subscripts is optional. Dimensional number of array variables; up to 60-dimensional multi-dimensional arrays. The Subscripts parameter uses the syntax as follows: [Lower to] Upper [, [Lower to] Upper].. If you do not explicitly specify the Lower, the lower bound of the array is controlled by the Option Base statement. If there is no Option Base statement, the lower bound is 0. NEW is optional. Make it implicitly created keywords. If you use the NEW to declare an object variable, create a new instance of the object when you first reference the variable, so you don't have to use the SET statement to assign the object reference. The NEW keyword cannot declare any internal data type variables and an instance of the slave object, and cannot be used with WitHevents. Type is optional. Data types of variables; can be Byte, Boolean, Integer, Long, Currency, Single, Double, Decimal (not supported), Date, String, String * Length, String), Object, Variant, user-defined type or object type. Each variable declares must have a separate AS TYPE clause. Note that the private variable can only be used in a module containing its declaration. You can declare the data type of the variable using the private statement. For example, the following statement declares a variable of an Integer type. Private NumberoFemPloyees AS INTEGER can also use the private statement to declare the object type of the variable. The following statement declares a variable for a new instance of the worksheet. Private x ask Worksheet

If the NEW keyword is not used when defining the object variable, you must use the SET statement to assign a variable of the reference object using the SET statement. Before assigning, the declared object variable has a specific value Nothing, which indicates that the variable does not point to any object. If the data type or object type is not specified, and the DEFTYPE statement is not used in the module, the variable is the Variant type by default. You can declare a dynamic array with empty parentheses, which can then define the dimension and elements of the array with the RedIM statement during the process. An error occurs if you try to redefine a dimension of an array of an array that has been explicitly defined in the private, public or DIM statement. When the variable is initialized, the numerical variable is initialized to zero, the growing string is initialized to a zero-length string ("), while the length of the string is filld by 0. Variant variable is initialized to EMPTY. Each element of the user's custom type variable is initialized as the respective independent variables. Note When using a Private statement during the process, the private statement is usually placed in the beginning of the process.

The Property get statement declares that the name, parameter, and code constituting its main body, which acquires a value of an attribute. Syntax [public | private] [static] Property Get Name [(arglist)] [as type] [statements] [name = expression] [eXIT Property] [statements] [name = expression] End Property Property Get Syntax Contains the following sections: Partially describe the PUBLIC optional. Indicates that all other processes of all modules can access the Property GET process. If used in a module containing Option Private, the process is not available outside the project. Private is optional. Indicates that other processes that only contain their declarations can access the Property GET process. Friend is optional. Can only be used in class modules. Indicates that the Property GET process is visible throughout the project, but the controller of the object instance is invisible. Static is optional. Indicates the value of the local variable of the Property GET process between the call. The Static property is not affected by the declared variables outside the Property Get, even if these variables are used during the process. Name must be. The name of the Property GET process; follows the standard variable naming agreement, but cannot be the same name with the Property LET or Property set process in the same module. Arglist is optional. Represents a variable list of parameters to pass to the Property GET process when calling. Multiple variables are separated by commas. The name and data type of each parameter in the Property GET process must be consistent with the parameters in the corresponding Property LET process (if there is). Type is optional. The data type of the return value of the Property GET process; can be Byte, Boolean, Integer, Long, Currency, Single, Double, Decimal (not supported), Date, String, Object, Variant or any user Define type. Any type of array cannot be used as a return value, but Variant containing an array can be used as a return value. The return value type of the Property GET process must be the same as the data type of the corresponding Property LET process (if any) parameter, the Property LET process assigns the value of the value to the attribute. Statements is optional. Any statement group executed in the Property GET process body. Expression is optional. The properties of the pro processs defined by the Property get statement. The syntax and grammar of the arglist parameters are as follows: [Optional] [Byval | Byref] [paramarray] varname [()] [as type] [= defaultValue]

Some describe Optional optional. Indicates that the parameters are not required. If this option is used, the subsequent parameters in Arglist are optional and must be declared using an Optional keyword. Byval is optional. Indicates that the parameter is passed by value. Byref is optional. Indicates that the parameter is passed by address. Byref is the default option for Visual Basic. Paramarray is optional. Only for the last parameters of Arglist, indicating that the last parameter is an Optional array of a Variant element. You can provide any number of parameters using the ParamarRay keyword. Paramarray keywords cannot be used with ByVal, Byref or Optional. Varname must be required. Represents the variable name of the parameters; follow the standard variable naming convention. Type is optional. Data types passing to the parameters of the process; can be Byte, Boolean, Integer, Long, Currency, Single, Double, Decimal (not supported), Date, String, Object or Variant. If the parameter is not Optional, it can also be a user-defined type, or an object type. DEFAULTVALUE is optional. Any constant or constant expression. It is legal only when the Optional parameter is legally. If the type is Object, the explicit default value can only be Nothing. Note If you do not use public, private, or Friend explicitly specified, the Property process is default. If STICIC is not used, the value of the local variable will not be retained after the call. Friend keyword can only be used in class modules. The Friend process can be accessed by any module in the project. The Friend process does not appear in the type library of its parent class, and the Friend process cannot be bound by later. All executable code must belong to a process. The Property GET process cannot be defined during other Property, Sub or Function. The EXIT Property statement makes the execution immediately exit from a property GET. The program then begins with the statement from the statement that calls the Property GET process. An exit property statement can be available anywhere in the Property GET process. The property get process is similar to the SUB and Property let processes: the Property GET process is an independent process that can get parameters, perform a series of statements, and changes the value of its parameters, and the SUB and Property Letches are different: When you want to return the value of the property, you can use the Property GET process on the right side of the expression, which is the same as the function named in the name or attribute. The Property Let statement declares that the name, parameter, and code constituting its main body are assigned to an attribute of the Property LET process. Syntax [public | private] [static] Property Let Name ([arglist,] value) [statements] [exit protection] [statements] End Property Property Let statement syntax included:

Partially describes public options. It means that all other processes of all modules can access the Property Let process. If used in modules containing Option Private, this process is not available outside of the project. Private is optional. The Property LET process can also be accessed only in other processes of the modules that contain their declarations. Friend is optional. Can only be used in class modules. Indicates that the Property LET process is visible throughout the project, but the controller of the object instance is invisible. Static is optional. Indicates the value of the local variable of the Property LET process between the call. The Static property will not affect the variables declared outside the Property LET, even if these variables are used during the process. Name must be. The name of the Property Let process; follows the standard variable naming conventions, but cannot be the same name with the Property Get or Property set process in the same module. Arglist is optional. Represents Variables list of parameters to pass to the Property LET process during call. Multiple variables are separated by commas. The name and data type of each parameter in the ProPerty Letter must be consistent with the corresponding parameters during the Property GET. Value is required. Refers to the variable used to assign a value to the attribute. When this process is called, this parameter appears on the right of the call expression. Value's data type must be consistent with the return value type of the corresponding Property GET process. Statements is optional. Any statement group executed during the ProPerty Let. The syntax and grammar of the arglist parameters are as follows: [Optional] [Byval | Byref] [paramarray] varname [()] [as type] [= defaultValue]

Some describe Optional optional. Indicates that the parameters are not required. If this option is used, the subsequent parameters in ArgList must be optional and must be declared using an Optional keyword. Note that the right side of a Property LET expression is impossible to Optional. Byval is optional. Indicates that the parameter is passed by value. Byref is optional. Indicates that the parameter is passed by address. Byref is the default option for Visual Basic. Paramarray is optional. Only for the last parameters of Arglist, indicating that the last parameter is an Optional array of a Variant element. You can provide any number of parameters using the ParamarRay keyword. Paramarray keywords cannot be used with ByVal, Byref or Optional. Varname must be required. Represents the name of the parameter variable; follow the standard variable naming convention. Type is optional. Data types passing to the parameters of the process; can be Byte, Boolean, Integer, Long, Currency, Single, Double, Decimal (not supported), Date, String, Object or Variant. If the parameter is not Optional, it can also be a user-defined type, or an object type. DEFAULTVALUE is optional. Any constant or constant expression. It is legal only when the Optional parameter is legally. If the type is Object, the explicit default value can only be Nothing. Note that each Property Let statement must define at least one parameter for the process it defined. This parameter (if there is a number of parameters, the last one refers to the last one), which contains the actual value that will be assigned to the attribute when the process defined by this. This parameter is Value in the aforementioned grammar. Note If you do not use public, private, or Friend explicitly specified, the Property process is default. If Static is not used, the value of the local variable will not be retained after the call. Friend keyword can only be used in class modules. However, the Friend process can be accessed by any module in the project. The Friend process does not appear in the type library of its parent class, and the Friend process cannot be bound by later. All executable code must belong to a process. You cannot define the Property LET process during other Property, Sub or FUNCTION. The EXIT Property statement makes the execution immediately exit from a Property LET. The program then begins with the statement from the statement that calls the Property LET process. There is an exit property statement in any location in the Property Let process. The Property LET process is similar to the function and the Property GET process: the Property Let process is an independent process that can get parameters, perform a series of statements, and change its parameter values. Unlike the Function and Property GET processes: these two processes have return values, and the Property Let process can only be used for the left side of the attribute expression or let statement. The Property Set statement declares the name, parameter, and code constituting its main body, which sets an object reference. Syntax [public | private] [static] Property Set Name ([arglist,] refrence "[statements] [exit property] [statements] End Property Property Syntax syntax contains the following sections:

Some describe Optional optional. Indicates that the caller can provide or do not provide this parameter. Public is optional. Indicates that all other processes of all modules can access this Property SET process. If used in modules containing Option Private, this process is not available outside of the project. Private is optional. Indicates that other processes that only contain their declarations can access the Property SET process. Friend is optional. Can only be used in class modules. Indicates that the Property SET process is visible throughout the project, but the controller of the object instance is invisible. Static is optional. Indicates the value of the local variable of the Property SET process between the call. The Static property does not affect the variables declared outside the Property SET, even if these variables are used during the process. Name must be. The name of the Property set process; follows the standard variable naming conventions, but cannot be the same name with the Property GET or Property LET process in the same module. Arglist is optional. Represents a list of variables that are passed to the Parameters of the Property SET process when calling. Separate with a comma for multiple variables. Reference must be. Object references the variables included in the right side of assignments. Statements is optional. Any statement group executed in the ProPerty process body. The grammar of the arglist parameter and the syntax are as follows: [Optional] [Byval | Byref] [paramarray] varname [()] [as type] [= defaultValue]

Some describe Optional optional. Indicates that the parameters are not required. If this option is used, the subsequent parameters in ArgList must be optional and must be declared using an Optional keyword. Note: The right side of the Property SET expression is Optional. Byval is optional. Indicates that the parameter is passed by value. Byref is optional. Indicates that the parameter is passed by address. Byref is the default option for Visual Basic. Paramarray is optional. Only for the last parameters of Arglist, indicating that the last parameter is an Optional array of a Variant element. You can provide any number of parameters using the ParamarRay keyword. Paramarray keywords cannot be used with ByVal, Byref or Optional. Varname must be required. Represents the name of the variable of the parameters; follow the standard variable naming convention. Type is optional. Data types passing to the parameters of the process; can be Byte, Boolean, Integer, Long, Currency, Single, Double, Decimal (not supported), Date, String, Object or Variant. If the parameter is not Optional, it can also be a user-defined type, or an object type. DEFAULTVALUE is optional. Any constant or constant expression. It is legal only when the Optional parameter is legally. If the type is Object, the explicit default value can only be Nothing. Note that each Property SET statement must define at least one parameter for the process it defined. When the process defined by the Property set statement is called, this parameter (if there are multiple parameters, the last one) contains an actual object reference that will assign an attribute. This parameter is the reference in the aforementioned syntax. It can't be Optional. Note If you do not use public, private, or Friend explicitly specified, the Property process is public in the default. If STICIC is not used, the value of the local variable will not be retained after the call. Friend keyword can only be used in class modules. However, the Friend process can be accessed by any module in the project. The Friend process does not appear in the type library of its parent class, and the Friend process cannot be bound by later. All executable code must belong to a process. You cannot define the Property SET process during other Property, Sub or FUNCTION. The EXIT Property statement makes the execution immediately from a Property set process. The program then executes a statement next statement from the statement that calls the Property SET process. An exit property statement can be available in any location of the Property SET process. The properties of the Property SET process with the Function and the Property GET process are: they are all independent processes that can get parameters, perform a series of statements, and change their parameters. Unlike the Function and Property GET processes: these two processes have return values, and the Property SET process can only be used for the left side of the object reference assignment (SET statement). The PUBLIC statement is used in the module level to declare public variables and allocate storage spaces. Syntax Public [WitHevents] Varname [([subscripts])] [As [new] type] [([witHevents] varname [([subscripts])] [as [new] type]].. PUBLIC statement syntax included below section:

Some describe WitHevents optional. Keywords, indicating that varName is an object variable used to respond to an event triggered by an ActiveX object. Only in class modules is legal. With WitHevents, you can define any single variables you need, but you cannot create arrays with WitHevents. NEW and WITHEVENTS cannot be used together. Varname must be required. The name of the variable; follow the standard variable naming convention. Subscripts is optional. Dimensional number of array variables; up to 60-dimensional multi-dimensional arrays. Subscripts parameters Use the following syntax: [Lower to] Upper [, [Lower to] Upper].. If you do not explicitly specify Lower, the lower bound of array is controlled by Option Base statement. If there is no Option Base statement, the lower bound is 0. NEW is optional. Use it to create a keyword for the object. If you use the NEW to declare an object variable, create a new instance of the object when you first reference the variable, so you don't have to use the SET statement to assign the object reference. The new keyword cannot be used to declare the variables of any internal data types and the instance of the slave object, and cannot be used with WitHevents. Type is optional. Data types of variables; can be Byte, Boolean, Integer, Long, Currency, Single, Double, Decimal (not yet supported), Date, String, String * Length (pair Strings), Object, or Variant, user-defined type, or object type. Each variable declared has a separate AS TYPE clause. Note The variable of the public statement declaration is available in any process of all the modules that do not use Option Private Module in all applications; if the module uses Option Private Module, the variable is only public in its own project. Note You cannot use a PUBLIC statement in a class module to declare a set of string variables. Use the public statement to declare the data type of the variable. For example, the following statement declares a variable of an Integer type. Public NumberOfemPloyees As INTEGER can also use the public statement to declare the object type of the variable. The following statement declares a variable for a new instance of the worksheet. Public x ask Worksheet

If the NEW keyword is not used when defining an object variable, you must use the SET statement to assign a variable of this reference object using the set statement. Before being assigned, the object variable declares has a specific value Nothing, which indicates that the variable does not point to an example of any object. Dynamic arrays can be declared with a PUBLIC statement with empty parentheses. After declaring the dynamic array, you can define the dimensions and elements of the array with the RedIM statement during the process. If you try to define a dimension of a dimension of an array that has been explicitly defined in the Private, Public or DIM statement, an error occurs. If the data type or object type is not specified, and the DEFTYPE statement is not used in the module, the variable is the Variant type by default. When the variable is initialized, the numerical variable is initialized to zero, the growing string is initialized to a zero-length string ("), while the length of the string is filld by 0. Variant variable is initialized to EMPTY. Each element of the user's custom type variable is initialized as the respective independent variables.

The PUT statement writes the data of a variable into the disk file. Syntax PUT [#] filenumber, [recnumber], the syntax of the VarName PUT statement has the following parts:

Partial description filenumber is necessary. Any valid file number. Recnumber is optional. Variant (long). Recording number (file file) or byte number (file of binary mode) indicates that you start writing here. Varname is necessary. Contains the variable name of the data to be written to the disk. Note The file data written by PUT is usually read in GET. The first record or byte in the file is located at position 1, the second record or byte is located at position 2, and so on. If RECNUMBER is omitted, the next record or byte is written next after the last GET or PUT statement (or the previous SEEK function). All commas for the boundary must be listed, for example: PUT # 4, FileBuffer The following rules apply to files that open in Random:

If the length of the written data is less than the length specified by the LEN clause of the Open statement, the PUT writes the subsequent record with the recording length as the boundary. The blank between the record end and the next record will be filled with the contents of the existing file buffer. Since the amount of data fill is not determined, it is generally, it is best to try the length of the record with the length of the write data. If the write data length is greater than the length specified by the LEN clause of the Open statement, the error will occur. If the written variable is a variable length string, the PUT is written first in a double-byte descriptor containing the string length, and then writes the variable. The recording length specified by the LEN clause of the Open statement is at least two bytes than the length of the actual string. If the written variable is a value type Variant, PUT is written first in two bytes to identify VARIANT's VARTYPE, and then write the variable. For example, when writing VARIANT of VARTYPE 3, PUT will write six bytes: where the first two bytes recognize Variant to VARTYPE 3 (long), the last four bytes contain the LONG type data. The recording length specified by the LEN clause of the Open statement must be at least two bytes more than the actual bytes required for the storage variable. Note that the PUT statement can be used to write a Variant array to disk, but cannot be used to write a scalar VARIANT containing an array to disk. PUT cannot be used to write objects to disk.

If the written variable is VARTYPE 8 (String) Variant, the PUT first writes two bytes to identify VARTYPE, and the next two bytes indicate the length of the string and then write string data. The recording length specified by the LEN clause of the Open statement must be at least four bytes more than the actual string length. If the written variable is a dynamic array, the PUT writes a descriptor whose length is equal to 2 plus 8 multiplying the dimension, ie 2 8 * Numberofdimensions. The recording length specified by the LEN clause of the Open statement must be greater than or equal to the sum of all bytes required to read the array data and array descriptors. For example, when writing the array to a disk, the following array sound name requires 118 bytes of space: DIM MyArray (1 to 5, 1 to 10) AS Integer

The 118-byte allocation is as follows: 18 bytes are used for descriptors (2 8 * 2), 100 bytes for data (5 * 10 * 2). If the written variable is a size fixed array, the PUT is only written to the data. It does not write a descriptor to disk. If the write variable is any other type of variable (not a variable length string or variant =, the PUT is only written to the variable data. The LEN clause of the Len clause of the LON clause is greater than or equal to reading Data length. When PUT is written to a user-defined element, in addition to being filling between elements, it seems to be written separately. On the disk, there is a descriptor located in the user-defined user-written in PUT. Before the dynamic array of types, the length is equal to 2 plus 8 multiplying the dimension, the 2 8 * NumberOfDimensions.open statement, the recording length specified by the LEN clause must be greater than or equal to writing to the respective elements (including any array) And its descriptor, the sum of the number of all bytes required. For files opened in binary, all of the above Random rules apply, except that the LEN clause in the Open statement does not work. The PUT statement continuously will Variables are written to disk; that is, there is no fill between two records. For any array of types that do not belong to user-defined types, PUT is only written to data. It does not write a descriptor. For non-user-defined types Variable length string, PUT writes it directly without having a double-byte descriptor. The number of bytes written is equal to the number of characters included in the string. For example, the following statements write ten bytes to the file number In 1 file: varstring $ = string $ (10,)

PUT # 1, Varstring $

The RaiseEvent statement is initiated in a class, form, or an event declared in the module level in the document. Syntax RaiseEvent EventName [(argumentlist)] Required EventName is declared in the module and meets the name of an event in accordance with the BASIC variable naming. The syntax of the RaiseEvent statement is as follows:

Partially describes EventName necessary. The name of the event raised. ArgumentList is optional. Use a comma-separated variable, array, or a list of expressions. ArgumentList must be enclosed in parentheses. If there is no parameters, parentheses must be ignored. Note If the event is not declared in the module that is raised, it will take an error. The following segment describes an event declaration and a process that triggered the event. 'Declaration of an event in the module module

Event logOncompleted (username as string)

Sub

'Run the event.

RaiseEvent Logoncompleted ("Antoinejan")

End Sub

If this event does not have a parameter in RaiseEvent, including empty parentheses, the call to the event will cause an error. You cannot use raiseEvent to trigger an event that is not clearly defined in the module. For example, if a form has a CLICK event, it cannot use raiseevent to raise the Click event of the form. If a CLICK event is declared in the form module, it will overwrite the form of your own Click event. You can still call the normal syntax calling the event to call the Click event, but cannot use the RaiseEvent statement. The initiation of the event is done according to the order established. Because the event can have a BYREF parameter, the process that is later connected may receive parameters that have been changed by an earlier event handler.

Randomize statement initializes the random number generator. Syntax Randomize [Number] Optional Number parameters are Variant or any valid numerical expression. Description Randomize initializes the random number generator of the RND function with Number, which gives Number a new seed value. If NUMBER is omitted, the value returned by the system timer is used as a new seed value. If you do not use Randomize, (None parameters) The RND function uses the seed value of the first call RND function. Note If you want to get a repeated random number sequence, the RND with the negative parameter value is directly called before using the randomize with numeric parameters. Use the Randomize with the same Number value that does not get duplicate random number sequences. The Redim statement is used in the process level to reassign the storage space for dynamic array variables. Syntax Redim [Preserve] VarName (Subscripts) [as type] [as type]]... The syntax of the Redim statement includes the following parts:

Partially describes Preserve optional. Keywords, when changing the size of the original array, using this keyword to maintain the original data in the array. Varname must be required. The name of the variable; follow the standard variable naming convention. Subscripts is required. Dimensional number of array variables; up to 60-dimensional multi-dimensional arrays. Subscripts parameters Use the following syntax: [Lower to] Upper [, [Lower to] Upper].. If you do not explicitly specify Lower, the lower bound of array is controlled by Option Base statement. If there is no Option Base statement, the lower bound is 0. Type is optional. Data types of variables; can be Byte, Boolean, Integer, Long, Currency, Single, Double, Decimal (not yet supported), Date, String, String * Length (pair Strings), Object, Variant, user-defined types or object types. Each variable declared has a separate AS TYPE clause. For Variant containing an array, Type describes the type of each element of the array, and cannot change this Variant to other types. Note The RedIM statement is used to define or redefine the size of the Dynamic array that has been declared with the private, public, or DIM statement that has been made with empty parentheses (no dimension). You can use the RedIM statement to repeatedly change the elements of the array and the number of dimensions, but cannot be defined to a certain data type after a array is not defined as a certain data type, and REDIM will be changed to other data types unless the array included in Variant. If the array is indeed included in a variant and does not use the preserve keyword, you can use the AS TYPE clause to change the type of its element, but in the case of this keyword, it is not allowed to change any data. Type of. If you use the preserve keyword, you can only redefine the size of the identical maximum dimension, and you can't change the number of dimensions. For example, if an array is one-dimensional, you can redefine the size of the dimension because it is the tentative dimension, and it is only one dimension. However, if the array is two-dimensional or more, only the contents of the array can only be retained at the same time. The following example describes how to increase any of the data contained in the existing dynamic array to increase its last dimensional size. Redim X (10, 10, 10)

.

Redim Preserve X (10, 10, 15)

Similarly, when using Preserve, only the size of the array can only be changed by changing the upper bound; change the lower bound. If the array is changed, the data in the deleted element is lost. If you pass the array to a process by address, don't double the size of each dimension of the array. At initialization variables, the numerical variable is initialized to 0, and the growing string is initialized into a zero-length string ("), while the fixed length string is filled with 0. Variant variable is initialized to EMPTY. Each element of the user's custom type variable is initialized as the respective independent variables. Before using the variables of the reference object, you must use the SET statement to assign an existing object to the variable. Before being assigned, the declared object variable has a particular value Nothing, which indicates that the variable does not point to an instance of any object. Note If the variables used by the RedIM statement do not exist at the module level or process level, the statement is equivalent to a declarative statement. If it has created the same name in a wider range, the REDIM will also use this variable that will also be used even if Option Explicit is used, and does not cause compilation errors. In order to avoid this conflict, the Redim should not be used as a statement statement, but should only be used as a statement of array size. Note To change the size of the arrays contained in Variant, you must explicitly declare the Variant variable before trying to change its array size.

The REM statement is used to include comments in the program. Syntax Rem Comment can also use the following syntax: 'Comment Comment parameters are optional, refer to any comment text to be included. Add a space between the REM keyword and Comment. Note If you use a line number or row tag, you can go to a REM statement from the GOTO or GOSUB statement. The program continues to execute from the first executable statement below the REM statement. If you use the REM key after other statements, you must use a colon (:) to separate from the statement. You can use an apostrophe (') instead of the REM key. If you use an apostrophe, you don't have to add a colon when using other statement lines.

The RESET statement closes all disk files that open with the Open statement. Grammatical RESET Description Reset statement Turn off all active files open in the Open statement, and write all the contents of the file buffer to disk.

The resume statement restores the original operation after the error handler ends. Syntax Resume [0] Resume Next Resume Line Resume statement syntax can have any of the following forms:

Statement Description Resume If the error and error handler appear in the same process, then recovery from generating errors. If the error occurs during the called, run from the statement that contains the error handler's process in the last call. Resume next If the error and the error handler appear in the same program, the following statement followed by the following statement that is incorrect. If the error occurs during the called, the statement (or the ON ERROR RESUME NEXT statement) containing the error handler is called, and the statement following the statement is restored from the statement after this statement. Resume Line resumes running at the Line specified by the necessary LINE parameters. The LINE parameter is a row tag or line number, and the error handler must be in the same process. Note Ancing the resume state in any place outside the error handler can cause an error.

The RMDIR statement deletes an existing directory or folder. Syntax RMDIR PATH The necessary path parameters are a string expression that specifies the directory or folder to be deleted. Path can include a drive. If no drive is specified, RMDIR will delete a directory or folder on the current drive. Note If you want to use RMDIR to delete a directory or folder containing a file, an error will occur. Use the Kill statement to delete all files before trying to delete a directory or folder. The RSET statement aligns a string to the right in a string variable. Syntax Rset Stringvar = String Rset statement The syntax below has the following sections:

Some describe the necessary parameters for StringVar. A string variable name. String necessary parameters. The string expressions that want to align to the right in Stringvar. Note If stringvar is longer than String, the RSET will replace the remaining characters in the StringVar in a blank until the string begins. Note that RSET cannot be used for user-defined types.

SaveSetting statements Save or establish an application project in the Windows Registry. Syntax SAVESETTING AppName, Section, Key, SETTING SAVESETTING statement syntax has the following naming parameters:

Partial description

Appname is necessary. String expressions, including applications or project names, settings section for these applications or projects. String expressions, containing the area name, saving registry key settings in this area. Key is necessary. String expression contains the name of the registry key set to be saved. Setting is necessary. Expression, contains the set value of Key. Note If the registry key setting is not saved anyway, the error will occur.

In the file in the Open statement, set the next read / write operation. Syntax Seek [#] filenumber, the syntax of the POSITION SEEK statement has the following sections:

Partial description filenumber is necessary. Any valid file number. Position is necessary. The numbers between 1 - 2, 147, 483, 647 indicate that the next read and write operation will occur. Note The record number specified in the GET and PUT statements will override the file location specified by the SEEK statement. If you do seek operation after the end of the file, the file written will expand the file. If you try to perform a SEEK operation for a file that is negative or zero, it will cause an error.

The SELECT CASE statement determines one of the few groups of statements based on the value of the expression. Syntax SELECT CASE TESTEXPIPRESSION [CASE ExpressionList-n]] ... [Case Else [ElseStatements]] End Select SELECT CASE statement syntax has the following sections:

Partially describes the necessary parameters of the TESTEXPRESSION. Any numerical expression or string expression. ExpressionList-n is the necessary parameters if there is case. Its form is a divided list of one or more of Expression, Expression TO Expression, IS ComparisonOperator Expression. The TO keyword can be used to specify a numerical range. If you use the TO keyword, the smaller value is before to TO. When using the IS keyword, you can specify a numerical range with the comparison operator (outside of IS and LIKE). If not provided, the IS key is automatically inserted. Statements-n optional parameters. One or more statements, execute when TESTEXPRESSION matches any part of ExpressionList-n. ElseStatements optional parameters. One or more statements are executed when TESTEXPRESSION does not match any part of the CASE clause. Note If TestExpression matches a Case ExpressionList expression, after the case clause, until the next case clause will be executed; if it is the last clause, it is executed to the End Select. Then the control will move to the statement after the End Select. If TESTEXPRESSION matches the ExpressionList expression in more than one CASE clause, only the first matching statement is executed. The CASE ELSE clause is used to specify ElseStatements. These statements are performed when the testExpression and all the expressionList in all CASE clauses do not match. Although it is not necessary, in the Select Case block, it is best to add a Case Else statement to handle unforeseen TESTEXPRESSION values. If there is no CASE ExpressionList to match TestExpression, and there is no Case Else statement, the program will continue to execute from the statement after the END SELECT. You can use multiple expressions or use ranges in each CASE clause, for example, the following statement is correct: Case 1 To 4, 7 To 9, 11, 13, IS> MaxNumber Note IS Comparison Operator and Used in Select The IS keyword in the CASE statement is not the same. It is also possible to specify ranges and multiple expressions for strings. In the following example, the string that the case is matched is: equal to everything, in the English alphabetical order, the current value represented by the TestItem is set in the English alphabetical order, and the current value represented by TestItem. Case "Everything", "NUTS" to "Soup", TestItem

The Select Case statement can also be nested. But each nested SELECT CASE statement must have a corresponding END SELECT statement.

The SendKeys statement sends one or more buttons to the active window, just as input on the keyboard. Syntax SendKeys String [, wait] SendKeys statement syntax has the following naming parameters:

Partially describes the string required. String Expressions Specify the button message to send. Wait is optional. Specifies the booleandefbooleandattype@veendf98.chm value of the waiting method. If you are false (default), the control returns to the process immediately after the button is sent. If you are TRUE, the button message must be processed before the control returns to the process. Note Each button is represented by one or more characters. In order to specify a single keyboard character, you must press the key of the character itself. For example, in order to represent letter A, "a" can be used as String. In order to indicate multiple characters, it must be plus another character behind the character. For example, to represent A, B and C, "ABC" is available as String. For SendKeys, plus sign ( ), insert (^), percentage symbol (%), upper underscore (~) and parentheses () have special significance. In order to specify any of the above characters, it is placed in a large bracket ({}). For example, you want to specify a positive number and you can use { }. Square brackets ([]) do not have special significance for SendKeys, but they must be placed in braces. In other applications, square brackets have special significance, and it may be important when dynamic data exchange (DDE) occurs. To specify the braces characters, use {{} and {}}. In order to specify the characters that do not display when pressing the button, such as Enter or Tab, and buttons that represent the action rather than characters, use the following code: Button code backspace {backspace}, {BS}, or {BKSP} Break {Break } Caps Lock {Capslock} DEL or DELETE {delete} or {DEL} Down Arrow {down} end {end} enter {ent} or ~ esc {esc} help {help} home {home} ins or insert {insert} or {INS} LEFT ARROW {LEFT} NUM LOCK {NUMLOCK} PAGE DOWN {PGDN} PAGE UP {PGUP} PRINT SCREEN {PRTSC} RIGHT ARROW {RIGHT} SCROLL LOCK {SCROLLLOCK} TAB {TAB} UP ARROW {UP} F1 {F1 } F2 {f2} f3 {f3} f4 {f4} f5 {f5} f6 {f6} f7 {f7} f8 {f8} f9 {f9} f10 {f10} f11 {f11} f12 {F12} f13 {f13} f14 {F14} F15 {F15} F16 {F16} In order to specify a combination of those combined with SHIFT, CTRL, and Alt, one or more code can be placed in front of these button code, and these code are listed as follows:

Press SHIFT CTRL ^ alt% To illustrate any combination of Shift, Ctrl, and Alt at the same time when you press other buttons, put the code of those buttons in parentheses. For example, in order to illustrate the Pressing the SHIFT key while pressing E and C, use " (EC)". To illustrate the Press the Shift key while pressing E, then press C without pressing SHIFT, using " EC". To specify the repetition key, use {key number}. A space must be placed between Key and Number. For example, {Left 42} means pressing the Left Arrow button in 42; {h 10} means 10 times Press the H button. Note You cannot send a button message to such an application with SendKeys, which is not designed to run in Microsoft Windows. SendKeys cannot send the print screen button {PRTSC} to any application. The SET statement assigns object reference to variables or properties. Syntax SET ObjectVar = {[New] ObjectExpression | Nothing} The syntax for the SET statement contains the following sections:

Partially describes objectvar necessary. The name of the variable or attribute follows the standard variable naming convention. NEW is optional. Normally use New when declaring so you can implicate an object. If New is used with SET, a new instance of this class will be created. If the ObjectVar contains an object reference, release the reference when you assign a new value. You cannot use the new keyword to create a new instance of any internal data type, or you cannot create a slave object. ObjectExpression is required. Other variables of the object name, the same object type, or the expression of a function or method of the same object type. Nothing is optional. Disconnect ObjectVar association with any specified object. If there is no other variable to point to ObjectVar, all the systems and memory resources associated with this object are released to Nothing. Note To ensure legal, Objectvar must be an object type that is consistent with the assigned object. DIM, Private, Public, Redim, and Static statements have only declare the variables of reference objects. This variable does not reference any actual object before use the SET statement to a specific object. The following example illustrates how to use DIM to declare an array of Form1 types. The Form1 actually has no instance. Then use SET to assign a reference to the newly created form1 to myChildForms variables. These codes can be used to create a child form in the MDI application. DIM MyChildForms (1 to 4) as Form1

Set mychildForms (1) = new form1

Set mychildforms (2) = new form1

Set mychildForms (3) = new form1

SET myChildForms (4) = New Form1

Typically, when using SET to assign an object to a variable, a copy of the object is not created for the variable, but a reference to the object is created. There are multiple object variables to reference the same object. Because these variables are only references to the object, not the object's copy, so any changes to the object will react to all variables that reference the object. However, if you use the New key in the Set statement, you will actually create an instance of this object.

SetAttr statements Set attribute information for a file. Syntax SetAttr Pathname, the syntax of the Attributes setAttr statement contains these named parameters:

Partially describes the necessary parameters of the Pathname. A string expression for specifying a file name, which may contain directories or folders, and drives. Attributes necessary parameters. Constant or numerical expressions, their sums of properties to represent files. Set value Attributes parameter settings can be: constant values ​​describe VBREADOONLY1 read-only. Vbhidden2 hides. VBSystem4 system files VBarchive32 After the last backup, the file has changed Note that these constants are specified by VBA, and these constants can be used to replace the true value in any position specified in the program code. Note If you want to set an open file to set the properties, a runtime error is generated.

The Static statement is used in the process level to declare the variable and allocate storage space. The value of the variable declared using the Static statement can be retained throughout the code. Syntax static varname [([subscripts])] [AS [new] type] [, varname "] [as [new] type]].. Static statement syntax contains the following sections:

Partially describes VarName necessary. The name of the variable; follow the standard variable naming convention. Subscripts is optional. Dimensional number of array variables; up to 60-dimensional multi-dimensional arrays. Subscripts parameters Use the following syntax: [Lower to] Upper [, [Lower to] Upper].. If you do not explicitly specify Lower, the lower bound of array is controlled by Option Base statement. If there is no Option Base statement, the lower bound is 0. NEW is optional. Use it to create a keyword for the object. If you use the New declaration of object variables, you will create an instance of the object when you first reference the variable, so you don't have to use the SET statement to assign the object reference. The New keyword cannot be used to declare the variable of any internal data type, and cannot be used to declare an example of the slave object. Type is optional. Data types of variables; can be Byte, Boolean, Integer, Long, Currency, Single, Double, Decimal (not yet supported), Date, String, String * Length (pair Strings), Object, Variant, user-defined types or object types. Each variable declared has a separate AS TYPE clause. After the code of the module starts running, the variable that is declared using the Static statement will remain its value until the module is reset or restarted. The explicit statement of the explicit statement that can be used in non-static processes only in this process, but there are variables that contain the same lifetime as the module defined by the process. You can use the Static statement during the process to declare the data type of the variable that can still maintain its value between the process call. For example, the following statement declares a constant array of fixed length: Static Employeenumber (200) AS INTEGER

The following statement declares a variable for the new instance of Worksheet: Static X as new worksheet

If the NEW keyword is not used when defining an object variable, you must use the SET statement to assign a variable of this reference object using the set statement. Before being assigned, the object variable declares has a specific value Nothing, which indicates that the variable does not point to an example of any object. If the NEW keyword is used in the statement, an instance of the object will be created when the object is first referenced. If the data type or object type is not specified, the variable is defined as a Variant type by default. Note that the Static statement is similar to the Static keyword, but is used for different effects. If you use Static keywords (such as static sub countsales ()) to declare a process, all local variables in the process are all assigned once, and the values ​​of these variables exist throughout the program. For non-static processes, the process is assigned a storage space for its variables each time, and the storage space of its variable is released when the process ends. The Static statement is used to declare a specific variable in non-static processes to keep their values ​​during program operation. At initialization variables, the numerical variable is initialized to 0, and the growing string is initialized into a zero-length string ("), while the fixed length string is filled with 0. Variant variable is initialized to EMPTY. Each element of the user's custom type variable is initialized as the respective independent variables. Note If you use the Static statement in the process, you should put it in the beginning of the process as follows. STOP statement pause execution. Syntax STOP Description You can place a STOP statement anywhere in the process, using the STOP statement, equivalent to setting breakpoints in the program code. The STOP statement will suspend the execution of the program, but it is not like end because STOP does not turn off any file, or clear the variable unless it is executed in compiled executable file (.exe).

The name, parameter, and code of the SUB statement declarative sub-process. Syntax [Private | Public | Friend] [Static] Sub Name [(arglist)] [statements] [exit sub] The syntax of the End Sub Sub statement contains the following sections:

Partially describes public options. Indicates that all other processes of all modules can access this sub process. If used in modules containing Option Private, this process is not available outside of the project. Private is optional. The SUB process is expressed that only other processes in the modules containing their declarations can be accessed. Friend is optional. Can only be used in class modules. Indicates that the SUB process is visible throughout the project, but the controller of the object instance is invisible. Static is optional. Indicates the value of the local variable of the SUB process between the call. The Static property will not affect the variables of the SUB declaration, even if these variables are used during the process. Name must be. The name of the SUB; following the standard variable naming convention. Arglist is optional. Represents a variable list of parameters to pass to the SUB process during call. Multiple variables are separated by commas. Statements is optional. Any statement group executed during the SUB process. The grammar of the arglist parameter and the syntax are as follows: [Optional] [Byval | Byref] [paramarray] varname [()] [as type] [= defaultValue]

Some describe Optional optional. Indicates that the parameter is not a required keyword. If this option is used, the subsequent parameters in ArgList must be optional and must be declared using an Optional keyword. If paramarray is used, any parameters cannot use Optional. Byval is optional. Indicates that the parameter is passed by value. Byref is optional. Indicates that the parameter is passed by address. Byref is the default option for Visual Basic. Paramarray is optional. Only for the last parameters of Arglist, indicating that the last parameter is an Optional array of a Variant element. You can provide any number of parameters using the ParamarRay keyword. ParamarRay keywords cannot be used with ByVal, Byref, or Optional. Varname must be required. Represents the name of the variable of the parameters; follow the standard variable naming convention. Type is optional. The data type of the parameter passed to the process can be Byte, Boolean, Integer, Long, Currency, Single, Double, DECIMAL (not supported), Date, String (support only), Object or Variant. If you do not select parameter Optional, you can specify the user-defined type, or the object type. DEFAULTVALUE is optional. Any constant or constant expression. Only legal for Optional parameters. If the type is Object, the explicit default value can only be Nothing. Note If you do not use public, private, or Friend explicitly specified, the SUB process is public in the default. If STICIC is not used, the value of the local variable will not be retained after the call. Friend keyword can only be used in class modules. However, the Friend process can be accessed by the process of any module of the project. The Friend process does not appear in the type library of its parent class, and the Friend process cannot be bound by later. Note that the SUB process can be recursive; that is, the process can call yourself to complete a particular task. However, recursive may cause the stack overflow. Usually static keywords and recursive SUB processes are not used together. All executable code must belong to a process. The SUB process cannot be defined in other sub, function, or proPerty. The EXIT SUB statement makes the execution immediately exits from a SUB process. The program is then executed next statement from the statement called the SUB process. An Exit Sub statement can be available anywhere in the SUB process. The SUB process is similar to the Function process: they all get a parameter, perform a series of statements, and the independent process of changing the value of its parameters. Unlike the function process: the SUB process with the return value cannot be used for expression. You can use the process name and follow the corresponding parameter list to call a SUB process. See the CALL statement about how to call a detailed description of the SUB process. The variables used in the SUB are divided into two categories: one is explicitly defined in the process, and the other is not. The variable defined in the process (using a DIM or equivalent method) is partial variable. For variables that are explicitly defined in the process, unless they are defined by the higher level of location outside the process, otherwise it is partially. Note The process can use the variables that are not explicitly defined within the process, but as long as there is any name and the same name in the module level definition, name conflicts will be generated. If the undefined variables used in the process are identical to other processes, constants, or variables, the name of the module level is considered to be used. Explicitly defined variables can avoid such conflicts. You can use an OPTION Explicit statement to force explicitly defined variables.

Note You cannot use GOSUB, GOTO or RETURN to enter or exit the SUB process. Time statement setting system time. Syntax Time = TIME The necessary TIME parameters can be any numerical expression, string expressions, or a combination thereof that can represent time. Note If the time is a string, the time will try to convert it to a time using the time separator according to the time specified by the system. If it is not possible to convert into an effective time, the error will occur.

The TYPE statement is used in the module level to define a user-defined data type containing one or more elements. Sype [Private | Public] Type VarNameElementName [([subscripts])] As Type [ElementName "] as type]... End Type Type statement syntax contains the following sections:

Partially describes public options. Used to declare the user-defined types used in any process of all the projects. Private is optional. Used to declare the user-defined type that can only be used in the module that contains the declaration. Varname must be required. User-defined names; follow standard variable naming conventions ElementName must be. User-defined element names. In addition to the keywords that can be used, the element name should also follow standard variable naming conventions. Subscripts is optional. Dimension of array elements. When defining a variable number of variables, it is only necessary. The subscripts parameter uses the following syntax: [LOWER TO] Upper [, [Lower to] Upper]... If not explicitly specifies the Lower, the lower bound of the array is controlled by the Option Base statement. If there is no Option Base statement, the lower bound is 0. Type must be. Element data type; can be Byte, Boolean, Integer, Long, Currency, Single, Double, DECIMAL (not supported), Date, String, String * Length, Strings), Object, Variant, other user-defined types or object types. Note The TYPE statement can only be used at the module level. After declaring a user-defined type using the TYPE statement, the variables of this type can be declared at any location within the scope. You can declare a variable of user-defined types using DIM, Private, Public, Redim or Static. In the standard module, the user-defined type is public in the default setting. You can use the private keyword to change its visibility. In the class module, the user-defined type can only be private, and its visibility cannot be changed using the public keyword. The line number and row tag is not allowed in the Type ... End Type block. User-defined types are often used to represent data records, and records are typically composed of a plurality of different data types. The following example demonstrates the usage of a user-defined type size fixed array: Type StateData

Citycode (1 to 100) as integer 'declare a static arch.

County as string * 30

End Type

DIM Washington (1 to 100) as StateData

In the above example, StateData includes a citycode static array, and the structure of the Washington is the same as STATEDATA. When declared in the user-defined type, the number of dimensions must be declared using digital text or constants without using variables. The lower bound of array is determined by the setting of the Option Base statement.

While ... Wend statement As long as the specified condition is True, a series of statements are repeated. Syntax While Condition [Statements] Wend While ... Wend statement syntax has the following sections: section describes the consisting necessary parameters. Value expression or string expression, its calculation results are true or false. If condition is null, Condition will be considered False. STATEMENTS optional parameters. One or more statements are performed when the conditions are TRUE. Note If condition is true, all Statements will execute and do it all the way to the WEND statement. Then return to the While statement and check again if the condition is still true, then repeat it. If not True, the program will continue to execute from the statement after the WEND statement. While ... Wend cycle can also be a multi-layer nested structure. Each Wend matches the nearest While statement. Prompt DO ... LOOP statement provides a structured method with more adaptive ways to perform a loop.

The Width # statement specifies the width of an output line to the file opened with the Open statement. Syntax width #filenumber, the syntax of the width width # statement has the following sections:

Partial description filenumber is necessary. Any valid file number. Width is necessary. The numerical expression between 0-255, which is pointed out in the new line, indicates how many characters can occur on this line. If Width is equal to 0, the length of the line is not limited. Width's default value is 0.

The WITH statement performs a series of statements on a single object or a user-defined type. The syntax of the syntax with object [statements] End with with the statement has the following parts:

Partially describes the necessary parameters of the Object. An object or user-defined name. STATEMENTS optional parameters. To perform one or more statements on Object. Note that the WITH statement can perform a series of statements for an object without repeating the name of the object. For example, to change multiple properties of an object, you can add the assignment statement of the attribute in the WITH control structure, which is just a reference object once instead of each property assignment to reference it. The following example shows how to use the with statement to assign a few attributes to the same object. With mylabel

.Height = 2000

.Width = 2000

.Caption = "this is mylabel"

End with

Note that Object cannot change when the program enters the WITH block. Therefore, multiple different objects cannot be set with a WITH statement. You can put a WITH block in the other, and create a nested with statement. However, since the outer WITH block members are shielded in the inner WITH block, they must be used in the inner WITH block, and the full object reference must be used to indicate the object members in the outer WITH block. In general, it is recommended that you do not jump into or jump out of the WITH block. If the statement in the WITH block is executed, the with or end with statement is not executed, and a temporary variable that is included in the object will remain in memory until you exit the process.

WRITE # statement writes data to sequential files. Syntax Write #filenumber, [OutputList] WRITE # statement syntax has the following sections:

Partial description filenumber is necessary. Any valid file number. OutputList is optional. To write a value expression or string expression of a file, these expressions are bound by one or more comma. Description Usually reads data written from the file with the INPUT # from the file. If OutputList is omitted, plus a comma after FILENUMBER, you will print a blank line to the file. A blank, a semicolon or comma can be separated between multiple expressions. Blank and semicolon equivalent. Write # will follow several universal agreements when data is written to files, making it available in INPUT # readout and correctly interpreting data: When writing to numerical data, the period is always used as a decimal separator. For Boolean Types, or Print # True # or print # false #. Regardless of the region, True and False are not translated. Write the Date type data into the file using a generic date format. When the component of the date or time is lost or zero, only the existing part is written to the file. If the data of OutputList is EMPTY, no data is written to the file. But for NULL data, you want to write # null #. If the outputList data is NULL data, # null # is written to the file. For ERROR type data, the output looks like #error errorcode #. Regardless of the region, you don't translate key error. Unlike the Print # statement, when you want to write the data into the file, the WRITE # statement will insert a comma between the project and the quotes used to mark strings. There is no need to type a clear delimiter in the list. The Write # statement is inserted into a new row character after writing the last character in OutputList, and the carriage return, (CHR (13) chr (10)).

转载请注明原文地址:https://www.9cbs.com/read-105216.html

New Post(0)