VBA (2) constant

Source: Internet
Author: User
Tags chr constant contains numeric readable reference
Constant Drive Type constant
You can use these constants only if your project has an explicit reference to the corresponding type library that contains the constants definitions.
Constant Value Description Unknown0 cannot determine the drive type. The Removable1 drive has removable media. Includes all floppy disk drives and many other types of storage devices. The FIXED2 Drive has fixed media (cannot be deleted). Includes all hard drives that can be removed from the hard drive. Remote3 Network Drive. Include drives that can be shared anywhere on the network. The CDROM4 drive is a CD-ROM. Includes a read-only CD-ROM and a writable CD-ROM. RAMDisk5
A drive is a random access memory (RAM) on the local computer that works as if it were a disk drive.




File attribute Constants
You can use these constants only if your project has an explicit reference to the corresponding type library that contains the constants definitions.
Constant numeric description Normal0 normal file. No properties are set. ReadOnly1 read-only files. property is readable/writable. Hidden2 hidden files. property is readable/writable. SYSTEM4 system files. property is readable/writable. Volume8 Disk drive volume label. property is read-only. Directory16 folder or directory. property is read-only. ARCHIVE32 files that have changed since the last backup. property is readable/writable. Alias64 links or shortcuts. property is read-only. Compressed128 compressed files. property is read-only.


File input/Output constants

You can use these constants only if your project has an explicit reference to the corresponding type library that contains the constants definitions.

Constant Value Description ForReading1 open file for read-only operation. You cannot write to a file. ForWriting2 open files for write operations. If a file with the same file name exists, the original contents of the file are overwritten. ForAppending8 opens the file and writes to the end of the file.
IMESTATUS constant
You can use the following constants anywhere in your code in place of the actual values.

The constants of the Japanese region are as follows:

Constant Value Description VbIMEModeNoControl0 does not have an IME installed (default) VBIMEMODEON1 open IMEvbIMEModeOff2 shutdown IMEvbIMEModeDisable3 Invalid IMEvbIMEModeHiragana4 Full width Hiragana mode vbIMEModeKatakana5 Full width Katakana mode vbIMEModeKatakanaHalf6 half width Katakana Pattern VBIMEMODEALPHAFULL7 Full Width alphanumeric mode
VBIMEMODEALPHA8 Half width alphanumeric mode




The constants of the Korean region are as follows:

Constant Value Description vbIMEModeAlphaFull7 full width alphanumeric mode vbIMEModeAlpha8 half width alphanumeric mode vbIMEModeHangulFull9 full 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 an IME installed (default) Vbimemodeon1ime open vbimemodeoff2ime off



KEYCODE constant

You can replace the actual values anywhere in your code with the following constants:

Constant Value Description vbkeylbutton0x1 left mouse button vbkeyrbutton0x2 the right mouse button Vbkeycancel0x3cancel key vbkeymbutton0x4 the middle mouse button 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 The screen key Vbkeyexecute0x2bexecute key Vbkeysnapshot0x2csnapshot key Vbkeyinsert0x2dinsert key Vbkeydelete0x2edelete Key Vbkeyhelp0x2fhelp key Vbkeynumlock0x90num LOCK key




The A to Z key is the same as the ASCII code of the A–z letter:

Constant Value Description vbkeya65a key vbkeyb66b vbkeyc67c key vbkeyd68d key vbkeye69e key vbkeyf70f key vbkeyg71g key vbkeyh72h Key vbkeyk75k key vbkeyl76l vbkeym77m key vbkeyn78n key vbkeyo79o key vbkeyp80p vbkeyq81q key VBKEYR82R key vbkeys83s Key vbkeyv86v key vbkeyw87w key vbkeyx88x key vbkeyy89y key vbkeyz90z key




The 0 to 9 keys are the same as the ASCII code of the digital 0–9:

Constant Value Description vbKey0480 key vbKey1491 key vbKey2502 key vbKey3513 key vbKey4524 key vbKey5535 key vbKey6546 keys vbKey7557 key vbKey8568




The following constants represent keys on the numeric keypad:

Constant Value Description 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 (/) key




The following constants represent the function keys:

Constant Value Description vbkeyf10x70f1 key vbkeyf20x71f2 key vbkeyf30x72f3 key Vbkeyf40x73f4 key Vbkeyf50x74f5 key Vbkeyf60x75f6 Key Vbkeyf80x77f8 key Vbkeyf90x78f9 key Vbkeyf100x79f10 key vbkeyf110x7af11 key vbkeyf120x7bf12 vbkeyf130x7cf13 key Vbkeyf140x7df14 Key Vbkeyf150x7ef15 key Vbkeyf160x7ff16 key

Miscellaneous constant

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

The constant equals the description VBCRLFCHR + Chr (10) Carriage return is combined with the newline character vbcrchr (13) Carriage return VBLFCHR (10) newline character vbnewlinechr (a) + CHR (a) or, on the Macintosh, CHR ( 13 A new line character specified by the platform; A string that applies to the current platform VBNULLCHARCHR (0) value of 0 vbNullString is used to invoke an external procedure; A string with a length of zero ("") Different vbObjectError-2147221504 user-defined error numbers should be greater than this value, for example:
Err.Raise number = vbObjectError + 1000vbTabChr (9) Tab. VBBACKCHR (8) BACKSPACE character VBFORMFEEDCHR (12) does not work in Microsoft Windows or on the Macintosh VBVERTICALTABCHR (11) at Microsoft or on the Ma Cintosh does not work in Windows


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.