Formating a string to fit the page

  • Thread starter Thread starter Igor
  • Start date Start date
I

Igor

Hi can anyone help with formating a string. I am sending one continius string
to the third party software from VBA Third party sofware can does not format
my string to fit the page basicaly it drops everything after certain number
of charachter E.G 125 characters. I can have a long string that is 500-600
charachters does anyone have any functions that would format my string
properly to have 125 charecters on one line and then put CTRLF and continue
printing .

Thanks in advance,
Igor
 
On Fri, 18 Jul 2008 08:02:05 -0700, Igor

If I understand you correctly you need a function like this:
Function WrapText(ByVal strText As String, ByVal intLength As Integer)
As String
Dim i As Integer
Dim strResult As String
For i = 0 To Len(strText) / intLength - 1
strResult = strResult & Mid$(strText, i * intLength + 1,
intLength) & vbCrLf
Next i
WrapText = strResult
End Function

?wraptext("abcdefghijklmnopqrstuvwxyz",10)
abcdefghij
klmnopqrst
uvwxyz

-Tom.
Microsoft Access MVP
 
Back
Top