Formating a string to fit the page

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
 
T

Tom van Stiphout

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top