Skip to content Skip to footer

辛苦整理的VBA关键字列表

Category

Action

Keywords

Arrays

Verify an array.

IsArray

Arrays

Create an array.

Array

Arrays

Change default lower limit.

Option Base

Arrays

Declare and initialize an array.

Dim, Private, Public, ReDim, Static

Arrays

Find the limits of an array.

LBound, UBound

Arrays

Reinitialize an array.

Erase, ReDim

Compiler Directives

Define compiler constant.

#Const

Compiler Directives

Compile selected blocks of code.

#If...Then...#Else

Control Flow

Branch.

GoSub...Return, GoTo, On Error, On...GoSub, On...GoTo

Control Flow

Exit or pause the program.

DoEvents, End, Exit, Stop

Control Flow

Loop.

Do...Loop, For...Next, For Each...Next, While...Wend, With

Control Flow

Make decisions.

Choose, If...Then...Else, Select Case, Switch

Control Flow

Use procedures.

Call, Function, Property Get, Property Let, Property Set, Sub

Conversion

ANSI value to string.

Chr

Conversion

String to lowercase or uppercase.

Format, LCase, Ucase

Conversion

Date to serial number.

DateSerial, DateValue

Conversion

Decimal number to other bases.

Hex, Oct

Conversion

Number to string.

Format, Str

Conversion

One data type to another.

CBool, CByte, CCur, CDate, CDbl, CDec, CInt, CLng, CLngLng, CLngPtr, CSng, CStr, CVar, CVErr, Fix, Int

Conversion

Date to day, month, weekday, or year.

Day, Month, Weekday, Year

Conversion

Time to hour, minute, or second.

Hour, Minute, Second

Conversion

String to ASCII value.

Asc

Conversion

String to number.

Val

Conversion

Time to serial number.

TimeSerial, TimeValue

Data Types

Convert between data types.

CBool, CByte, CCur, CDate, CDbl, CDec, CInt, CLng, CLngLng, CLngPtr, CSng, CStr, CVar, CVErr, Fix, Int

Data Types

Set intrinsic data types.

Boolean, Byte, Currency, Date, Double, Integer, Long, LongLong, LongPtr, Object, Single, String, Variant (default)

Data Types

Verify data types.

IsArray, IsDate, IsEmpty, IsError, IsMissing, IsNull, IsNumeric, IsObject

Dates and Times

Get the current date or time.

Date, Now, Time

Dates and Times

Perform date calculations.

DateAdd, DateDiff, DatePart

Dates and Times

Return a date.

DateSerial, DateValue

Dates and Times

Return a time.

TimeSerial, TimeValue

Dates and Times

Set the date or time.

Date, Time

Dates and Times

Time a process.

Timer

Directories and Files

Change directory or folder.

ChDir

Directories and Files

Change the drive.

ChDrive

Directories and Files

Copy a file.

FileCopy

Directories and Files

Make directory or folder.

MkDir

Directories and Files

Remove directory or folder.

RmDir

Directories and Files

Rename a file, directory, or folder.

Name

Directories and Files

Return current path.

CurDir

Directories and Files

Return file date/time stamp.

FileDateTime

Directories and Files

Return file, directory, label attributes.

GetAttr

Directories and Files

Return file length.

FileLen

Directories and Files

Return file name or volume label.

Dir

Directories and Files

Set attribute information for a file.

SetAttr

Errors

Generate run-time errors.

Clear, Error, Raise

Errors

Get error messages.

Error

Errors

Provide error information.

Err

Errors

Return Error variant.

CVErr

Errors

Trap errors during run time.

On Error, Resume

Errors

Type verification.

IsError

Financial

Calculate depreciation.

DDB, SLN, SYD

Financial

Calculate future value.

FV

Financial

Calculate interest rate.

Rate

Financial

Calculate internal rate of return.

IRR, MIRR

Financial

Calculate number of periods.

NPer

Financial

Calculate payments.

IPmt, Pmt, PPmt

Financial

Calculate present value.

NPV, PV

Input and Output

Access or create a file.

Open

Input and Output

Close files.

Close, Reset

Input and Output

Control output appearance.

Format, Print, Print #, Spc, Tab, Width #

Input and Output

Copy a file.

FileCopy

Input and Output

Get information about a file.

EOF, FileAttr, FileDateTime, FileLen, FreeFile, GetAttr, Loc, LOF, Seek

Input and Output

Manage files.

Dir, Kill, Lock, Unlock, Name

Input and Output

Read from a file.

Get, Input, Input #, Line Input #

Input and Output

Return length of a file.

FileLen

Input and Output

Set or get file attributes.

FileAttr, GetAttr, SetAttr

Input and Output

Set read-write position in a file.

Seek

Input and Output

Write to a file.

Print #, Put, Write #

Math

Derive trigonometric functions.

Atn, Cos, Sin, Tan

Math

General calculations.

Exp, Log, Sqr

Math

Generate random numbers.

Randomize, Rnd

Math

Get absolute value.

Abs

Math

Get the sign of an expression.

Sgn

Math

Perform numeric conversions.

Fix, Int

Miscellaneous

Process pending events.

DoEvents

Miscellaneous

Run other programs.

AppActivate, Shell

Miscellaneous

Send keystrokes to an application.

SendKeys

Miscellaneous

Sound a beep from computer.

Beep

Miscellaneous

System.

Environ

Miscellaneous

Provide a command-line string.

Command

Miscellaneous

Automation.

CreateObject, GetObject

Miscellaneous

Color.

QBColor, RGB

Operators

Arithmetic.

^, –, *, /, \, Mod, +, &, =

Operators

Comparison.

=, <>, <, >, <=, >=, Like, Is

Operators

Logical operations.

Not, And, Or, Xor, Eqv, Imp

String Manipulation

Compare two strings.

StrComp

String Manipulation

Convert strings.

StrConv

String Manipulation

Convert to lowercase or uppercase.

Format, Lcase, Ucase

String Manipulation

Create string of repeating character.

Space, String

String Manipulation

Find length of a string.

Len

String Manipulation

Format a string.

Format

String Manipulation

Justify a string.

LSet, Rset

String Manipulation

Manipulate strings.

InStr, Left, LTrim, Mid, Right, RTrim, Trim

String Manipulation

Set string comparison rules.

Option Compare

String Manipulation

Work with ASCII and ANSI values.

Asc, Chr

Variables and Constants

Assign value.

Let

Variables and Constants

Declare variables or constants.

Const, Dim, Private, Public, New, Static

Variables and Constants

Declare module as private.

Option Private Module

Variables and Constants

Get information about a variant.

IsArray, IsDate, IsEmpty, IsError, IsMissing, IsNull, IsNumeric, IsObject, TypeName, VarType

Variables and Constants

Refer to current object.

Me

Variables and Constants

Require explicit variable declarations.

Option Explicit

Variables and Constants

Set default data type.

Deftype

Copyright © 2088 我的世界杯_瑞奇马丁世界杯主题曲 - msdc8.com All Rights Reserved.
友情链接