Constants to be used in VBA 1th/2 page _vba

Source: Internet
Author: User
Tags constant locale win32

Calendar Constants

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

Constants value Description
Vbcalgreg 0 It is noted that the Gregorian calendar is used.
Vbcalhijri 1 It was pointed out that the Islamic calendar was used.

Color Constants

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

Constants value Description
Vbblack 0x0 Black
vbred 0xFF Red
Vbgreen 0xff00 Green
Vbyellow 0xFFFF Yellow
Vbblue 0xff0000 Blue
Vbmagenta 0xff00ff Purplish red
Vbcyan 0xffff00 Cyan
Vbwhite 0xFFFFFF White

CALLTYPE constant

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

Constants value Description
Vbmethod 1 Indicates that a method has been called.
Vbget 2 Indicates a Property Get procedure.
Vblet 4 Indicates a Property Let process.
Vbset 8 Indicates a property Set procedure.
The following Constants from the Visual Basic for Applications type library definition, which can be used to replace the actual value anywhere in the code:

Comparison constant

Constants value Description
Vbusecompareoption -1 Use the settings for the Option Compare statement to compare.
Vbbinarycompare 0 Make a binary comparison.
vbTextCompare 1 Make a comparison of the text.
Vbdatabasecompare 2 For Microsoft Access (Windows only), for comparisons based on information contained in the database.

COMPILER constant

Visual Basic for applications defines some that cannot be associated with the #If ... Then A constant used with a #Else instruction. These constants are global in addition to their scope, that is to say, in addition to being applied everywhere in engineering, in terms of functional and #If ... Then. #Else directive defines the same constants.

On the 16-bit development platform, the compilation constants are defined as follows:

Constants value Description
Win16 True Indicates that the development environment is 16 bits.
Win32 False Indicates that the development environment is not 32 bits.

On the 32-bit development platform, the compilation constants are defined as follows:

Constants value Description
Vba6 True Indicates that the development environment is Visual Basic for applications, version 6.0.
Vba6 False Indicates that the development environment is not visual Basic for Applications, version 6.0.
Win16 False Indicates that the development environment is not 16 bits.
Win32 True Indicates that the development environment is 32 bits.

Mac False Indicates that the development environment is not Macintosh.
Win16 False Indicates that the development environment is not 16-bit.
Win32 False Indicates that the development environment is not 32-bit.
Mac True Indicates that the development environment is Macintosh.

AttentionThese constants are provided by Visual Basic, so you cannot define your own constants in any hierarchy with the same name.

DATE constant

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

Parameter values

The firstdayofweek parameter has the following values:

Constants value Description
Vbusesystem 0 Use the NLS API settings.
Vbsunday 1 Sunday (default)
Vbmonday 2 Monday
Vbtuesday 3 Tuesday
Vbwednesday 4 Wednesday
Vbthursday 5 Thursday
Vbfriday 6 Friday
Vbsaturday 7 Saturday

The firstdayofyear parameter has the following values:

The
constant value description
vbusesystem 0
Vbusesystemdayofweek 0
VbFirstJan1 1
vbfirstfourdays 2
vbfirstfullweek 3

return value

Constants value Description
Vbsunday 1 Sunday
Vbmonday 2 Monday
Vbtuesday 3 Tuesday
Vbwednesday 4 Wednesday
Vbthursday 5 Thursday
Vbfriday 6 Friday
Vbsaturday 7 Saturday

Date Format Constants

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

Constants value Description
Vbgeneraldate 0 Displays the date and/or time. For a real number, display the date and time. If you do not have a decimal part, only the date is displayed. If there is no integer part, only the time is displayed. The display of the date and time is determined by the system setting value.
vbLongDate 1 Displays a date in a long date format specified by the computer locale value.
Vbshortdate 2 Displays a date in the short date format specified by the computer locale value.
Vblongtime 3 Displays the time in a long time format specified by the computer locale value.
vbShortTime 4 Displays the time in a short time format specified by the computer locale value.

Dir, GetAttr, and SetAttr constants

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

Constants value Description
Vbnormal 0 Normal (the default values forDir and setattr )
vbReadOnly 1 Read-only
Vbhidden 2 Hidden from
Vbsystem 4 System files
VbVolume 8 Volume label
Vbdirectory 16 Directory or folder
Vbarchive 32 The file has changed since the last backup
Vbalias 64 On the Macintosh, the identifier is an alias.

On the Macintosh, only vbnormal, vbreadonly, vbhidden , and Vbalias are available.

Current 1/2 page 12 Next read the full text

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.