Re: Warp a String



Hi Rick,

I thanks for your reply. But I want No. of Lines & Text of Particular Line.
In your example the No. of Lines is also not coming properly because you had
used MOD operator to increase line.

If you know the FoldSting WinAPI then please reply me it's usage.

Sanjay Shah

Rick Rothstein <rickNOSPAMnews@xxxxxxxxxxxxxxxxx> wrote in message
news:ucxnBnpaGHA.5088@xxxxxxxxxxxxxxxxxxxxxxx
I am having a string contain Item description may have length upto 64KB
character including VbCrLf.

1. How to find No. of Lines in String if warp at 41 character or VbCrLf
which is earlier.

Off the top of my head, I think this function should return the proper
number:

Function LineCount(TextIn As String, _
Optional LineLength As Long = 41) As Long
Dim X As Long
Dim Lines() As String
Lines = Split(YourText, vbCrLf)
LineCount = UBound(Lines) + 1
For X = 0 To UBound(Lines)
LineCount = LineCount + (Len(Lines(X)) - 1) Mod LineLength
Next
End Function


Rick




.



Relevant Pages

  • Re: Code to check if a valid e-mail address was entered
    ... Function Valid_Email(E_Address As String) As Boolean ... ' Note that the part after the @ sign must contain at least one dot, ... ' at least one other character following it, ... Dim TString As String ...
    (microsoft.public.access.modulesdaovba)
  • Re: Document Property to display more than 1 line
    ... then use the following macro to identify the character ... Dim strNums As String ...
    (microsoft.public.word.newusers)
  • Code problem Help!
    ... Dim strCompname As String ... Dim strFirstname As String ... strFirstname & vbCrLf & _ ...
    (microsoft.public.access.formscoding)
  • Re: Eval code and AppDomains
    ... Crossing app domains and generating these assemblies ... > I needed a way to Eval this string and return a Boolean result. ... > Dim objEval As New EvalProvider ... > sb.Append("Imports System.Data" & vbCrLf) ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Copying files from the CD using SHFileOperation API
    ... > pFrom As String ... > Dim sOrigin As String ... > Dim SHFileOp As SHFILEOPSTRUCT ... VB terminates with a null character automatically. ...
    (microsoft.public.vb.winapi)

Quantcast