Skip to content

Latest commit

 

History

History
48 lines (33 loc) · 1.33 KB

widthstatement.md

File metadata and controls

48 lines (33 loc) · 1.33 KB
title keywords f1_keywords ms.assetid ms.date ms.localizationpriority
Width statement (VBA)
vblr6.chm1009060
vblr6.chm1009060
655e73fc-c294-5f82-4c1a-59c2ebd71036
12/03/2018
medium

Width # statement

Assigns an output line width to a file opened by using the Open statement.

Syntax

Width #filenumber, width

The Width # statement syntax has these parts:

Part Description
filenumber Required. Any valid file number.
width Required. Numeric expression in the range 0–255, inclusive, that indicates how many characters appear on a line before a new line is started. If width equals 0, there is no limit to the length of a line. The default value for width is 0.

Example

This example uses the Width # statement to set the output line width for a file.

Dim I 
Open "TESTFILE" For Output As #1 ' Open file for output. 
VBA.Width 1, 5 ' Set output line width to 5. 
For I = 0 To 9 ' Loop 10 times. 
 Print #1, Chr(48 + I); ' Prints five characters per line. 
Next I 
Close #1 ' Close file. 

See also

[!includeSupport and feedback]