• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 361
  • Last Modified:

Padding Strings into Textbox

I'm trying to figure out how to Pad fields in strings, basically I have information that needs to be separated by a certain amount of spaces.  I have several text fields that all have different data and each will be different on the amount of spaces required as well may have more or less columns.

I.E. (I need this kind of format were each column is in line)
1   1098774978                  79787440604604665540                     44587749        7790014              3
34 109878                          7978744060460466                             87749              77014                  2
(Not this, if the numbered strings are shorter or longer than any others)
34 109878                  7978744060460466                     87749        77014              2
  • 2
1 Solution
You can pad a field to a fixed length, say 10 characters

strNew = Left$(strField & space(10),10)
Alternatively you can use fixed-length string variables

Dim strNew As String * 10
strNew = strField

Open in new window

thaburnerAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now