How to get the list of Visual Basic blue words
Visual Basic blue words - are the words that appear in blue in VB IDE. Some of them are keywords, some are statements, some (And, Or, etc.) - operators (and functions, and data types). There is no logical explanation why IDE renders some words in blue. Apparently it's hard-coded. Of course, no related documentation exists.
To build the list of blue words I took the following approach:
- downloaded MSDN XML index for a little-known document "VBA Reference for Office 97" (cached), which contains most of all the functions/operators/etc.
- parsed XML into textfile with each item on separate line and got rid of item definitions ("Statement", "Operator", etc.)
- we copied the content of resulting textfile into VB IDE and tweaked it to get rid of red lines
- deleted everything but blue words, removed duplicates and replaced linefeeds with commas
- manually added new blue words from VB6 reference
- resulting file contains 132 blue words.
Logically Grouped Blue Words
| Operators |
| AddressOf, And, Eqv, Imp, Is, Like, Mod, Not, Or, Xor |
| Declarative statements |
| Option Base 1, Option Compare Binary, Option Compare Text, Option Compare Database, Option Explicit, Option Private Module |
| Private, Public, Static, Friend, Global, WithEvents |
| Const, Dim, Type, Function, Sub, Property, Enum, Event |
| Declare, Lib, Alias, Any |
| Get, Let, Set |
| ByRef, ByVal, Optional, ParamArray |
| As, New |
| With |
| Implements |
| DefBool, DefByte, DefCur, DefDate, DefDbl, DefInt, DefLng, DefObj, DefSng, DefStr, DefVar |
| Simple data types |
| Binary, Boolean, Byte, Date, Currency, Double, Integer, Long, Object, Single, String, Variant |
| Program flow statements |
| Call, Exit, GoSub, GoTo, On, Resume, Return, Stop, Error, Debug, RaiseEvent |
| Conditional statements and loops |
| End, If, Else, Then, In, Do, Loop, For, To, Next, Step, Each, Select, Case, While, Wend |
| Data type conversion functions |
| CBool, CByte, CCur, CDate, CDbl, CInt, CLng, CSng, CStr, CVar |
| File operations statements |
| Open, Close, Input, Output, Random, Read, Write, Len, Line, Print, Name, Get, Put, Seek, Lock, Unlock, Spc, Tab |
| Array statements |
| LBound, UBound, Erase, ReDim, Preserve |
| Misc |
| CVErr, LSet, RSet, Nothing, Null |
Related article: How to get the list of Visual Basic Keywords
|