Used with the Print or PrintLine functions to position output.
Public Function SPC(ByVal Count As Short) As SPCInfo
If Count is less than the output line width, the next print position immediately follows the number of spaces printed. If Count is greater than the output line width, SPC calculates the next print position using the formula:
currentprintposition + (Count Mod
width)
For example, if the current print position is 24, the output line width is 80, and you specify SPC(90), the next print will start at position 34 (current print position + the remainder of 90/80). If the difference between the current print position and the output line width is less than Count (or Count Mod width), the SPC function skips to the beginning of the next line and generates spaces equal to Count (width currentprintposition).
Note Make sure your tabular columns are wide enough to accommodate wide letters.
This example uses the SPC function to position output in a file and in the Output window.
' The SPC function can be used with the Print function. FileOpen(1, "TESTFILE", OpenMode.Output) ' Open file for output. Print(1, "10 spaces between here",SPC(
10)
, "and here.") FileClose(1) ' Close file.
The following statement causes the text to be printed in the Output window (using the WriteLine method), preceded by 30 spaces.
Debug.WriteLine(SPC(
30),
"Thirty spaces later...")
Mod Operator | Print, PrintLine Functions | Space Function | TAB Function | FileWidth Function