Used with the Print # statement to position output.
Tab[(n)] |
The optional n argument is the column number moved to before displaying or printing the next expression in a list. If omitted, Tab moves the insertion point to the beginning of the next print zone. This allows Tab to be used instead of a comma in locales where the comma is used as a decimal separator.
If the current print position on the current line is greater than n, Tab skips to the nth column on the next output line. If n is less than 1, Tab moves the print position to column 1. If n is greater than the output line width, Tab calculates the next print position using the formula:
n Mod width
For example, if width is 80 and you specify Tab(90), the next print will start at column 10 (the remainder of 90/80). If n is less than the current print position, printing begins on the next line at the calculated print position. If the calculated print position is greater than the current print position, printing begins at the calculated print position on the same line.
The leftmost print position on an output line is always 1. When you use the Print # statement to print to files, the rightmost print position is the current width of the output file, which you can set using the Width # statement.
Note. Make sure your tabular columns are wide enough to accommodate wide letters.
This example uses the Tab function to position output in a file.
' The Tab function can be used with the Print # statement. Open "TESTFILE" For Output As #1 ' Open file for output. ' The second word prints at column 20. Print #1, "Hello"; Tab(20); "World!" ' If the argument is omitted, cursor is moved to the next print zone. Print #1, "Hello"; Tab(1); "World!" Close #1 ' Close file. |
See Also |
Print # Statement, Width # Statement, Mod Operator, Space Function , Spc Function |