Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub colWidth()
- Dim widthArray() As String
- Dim myFile, textline As String
- Dim x, y As Integer
- 'example text file containing column widths
- myFile = "C:qqqqqqqqqwidths.txt"
- 'loop through the file and store each column width in an array
- Open myFile For Input As #1
- x = 1
- Do Until EOF(1)
- Line Input #1, textline
- ReDim Preserve widthArray(1 To x)
- widthArray(x) = textline
- x = x + 1
- Loop
- Close #1
- 'using the array of column widths to adjust columns
- For y = 1 To UBound(widthArray)
- Columns(y).ColumnWidth = Int(widthArray(y))
- Next y
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement