一覧表

マクロ予約語一覧※変数名で使用不可一覧【ExcelVBA】

VBAマクロで変数名に使用できない予約語一覧をまとめました。
詳細はMicrosoftの公式サイトでご確認ください。

VBA予約語一覧

予約語とは、字句的には識別子(変数名、関数名、クラス名など)としてのルールを
満たしているにもかかわらず、識別子にならない字句要素のこと。

AddHandler AddressOf Alias And
AndAlso As Boolean ByRef
Byte ByVal Call Case
Catch CBool CByte CChar
CDate CDbl CDec Char
CInt Class CLng CObj
Const Continue CSByte CShort
CSng CStr CType CUInt
CULng CUShort Date Decimal
Declare Default Delegate Dim
DirectCast Do Double Each
Else ElseIf End EndIf
Enum Erase Error Event
Exit FALSE Finally For
For Each…Next Friend Function Get
GetType GetXMLNamespace Global GoSub
GoTo Handles If If()
Implements Implements Imports  In
Inherits Integer Interface Is
IsNot Let Lib Like
Long Loop Me Mod
Module MustInherit MustOverride MyBase
MyClass NameOf Namespace Narrowing
New Next Not Nothing
NotInheritable NotOverridable Object Of
On Operator Option Optional
Or OrElse Out Overloads
Overridable Overrides ParamArray Partial
Private Property Protected Public
RaiseEvent ReadOnly ReDim REM
RemoveHandler Resume Return SByte
Select Set Shadows Shared
Short Single Static Step
Stop String Structure Sub
SyncLock Then Throw To
TryCast TypeOf…Is TRUE Try
UInteger ULong UShort Using
Variant Wend When While
Widening With WithEvents WriteOnly
Xor #Const #Else #ElseIf
#End #If
= & &= *
*= / /= \
\= ^ ^= +
+= -= >>
>>= << <<=

予約語を変数名で使用するとコンパイルエラー

Dim dim as Long のように予約語を変数名に使用するとエラーが発生します。

「コンパイルエラー: 構文エラー

 

コメント