Tab Function

Syntax

Tab[(colno)]

colno

Use: Optional

Data Type: Integer

A column number to which the insertion point moves before displaying or printing the next expression.

Description

Moves the text insertion point to a given column or the start of the next print zone

Rules at a Glance

  • If the colno argument is omitted, the text insertion point is moved to the beginning of the next print zone.

  • The value of colno determines the behavior of the insertion point:

    Value of colno Position of Insertion Point
    Current column > colno Moves one line down and moves to the colno column.
    colno > Output Width Uses the formula colno Mod width. If the result is less than the current insertion point, the insertion point moves down one line; otherwise, the insertion point remains on the same line.
    < 1 Column 1
  • The left column is always 1.

  • When expressions are output to files using the Print # statement, the width of the output is determined by the Width # statement.

  • When output is sent to either the screen or the printer, the surface is divided into columns, the width of each column being the average width of all characters in the current point size of the current font. This means that the number of columns for tabulation purposes doesn't necessarily relate to the number of characters that can be printed across the width of the output surface.

Programming Tips and Gotchas

  • When placing output on the Printer object, use the TextWidth method to determine the actual width of a given string in a given ...

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.