Debug.Print Method |
Syntax
object.Print [outputlist]
object
Use: Required
Data Type: Debug object
Always evaluates to the Debug object.
outputlist
Use: Optional
Data Type: String
Expression or list of expressions to print. If omitted, a blank line is printed (for details, see the following table).
Output Syntax
{Spc(n) | Tab(n)} expression charpos
Spc( n)
Use: Optional
Inserts n space characters in the output string.
Tab( n)
Use: Optional
Inserts a Tab character at position n.
expression
Use: Optional
Numeric or string expression to print in the Immediate window.
charpos
Use: Optional
Determines the position of the next character.
Description
Prints text in the Immediate pane of the Debug window in the design-time environment.
Rules at a Glance
expression can include literal, numeric, string, and variant data.
If charpos is a semicolon (;), the next character immediately follows the last character of expression. For example:
Debug.Print sFileName; iFileNo
The Tab(n) argument doesn't actually insert any tab characters (Chr(9)); it fills the space from the end of the last expression to column n (or to the start of the next print zone) with space characters.
You can also use Tab(n) as the charpos argument to position the next character at an absolute column number.
If charpos is omitted, a carriage return is appended to expression, and the next character is printed on the next line.
Use the & concatenation character to create an output string from several elements.
The Debug.Print ...
Get VB & VBA in a Nutshell: The Language 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.