Name
Rem Statement
Syntax
Remcomment
'comment
comment
Use: Optional
A textual comment to place within the code.
Description
Use the Rem
statement or an
apostrophe (') to place remarks within the code.
Rules at a Glance
Apostrophes held within quotation marks aren’t treated as comment markers, as this code snippet shows:
myVar = "'Something'"
VBA/VBScript Differences
In VBA, if you use the
Rem
statement (but not the apostrophe) on the same line as program code, a colon is required after the program code and before theRem
statement. For example:Set objDoc = Server.CreateObject("MyApp.MyObj") : Rem Define the object Rem reference
VBScript, on the other hand, successfully recognizes the
Rem
statement even without the colon.In VBA using the VBA editor, if you “comment out” a line, that line and all of its line continuations are affected. In VBScript, the comment keyword or symbol must be added to each line to be “commented out.”
Get VBScript in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.