Name
Rem Statement
Syntax
Remcomment'comment
commentUse: 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
Remstatement (but not the apostrophe) on the same line as program code, a colon is required after the program code and before theRemstatement. For example:Set objDoc = Server.CreateObject("MyApp.MyObj") : Rem Define the object Rem referenceVBScript, on the other hand, successfully recognizes the
Remstatement 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.”
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access