[AccessD] Parsing text

Francisco Tapia fhtapia at gmail.com
Fri Sep 16 09:19:08 CDT 2005


You guys are AWESOME

On 9/15/05, Stuart McLachlan <stuart at lexacorp.com.pg> wrote:
> 
> On 15 Sep 2005 at 17:53, Francisco Tapia wrote:
> 
> > does anyone have a routine that will do the following:
> >
> > SOME TEXT ENTERED HERE
> > SOME MORE ENTERED HERE
> > AGAIN
> >
> > it'd prefer to have the code handle this on the ON CHANGE EVENT the idea 
> is
> > to have the text break at the 25th character but if the break is in the
> > middle of the word, I will need the break to occur before the word so it
> > ends up on the next line as the sample above is shown... i'm posting 
> here in
> > case someone has ran into this situation before...
> >
> 
> Heres a simple wordwrap function.
> Note that it only wraps on spaces. If a "word" (which may be any string of
> characters not including a space) is longer that MaxChars, it will not be
> split.
> 
> Function WordWrap(InputString As String, MaxChars As Long) As String
> Dim lngPointer As Long
> Dim lngLoopCount As Long
> Dim lngLastPointer As Long
> Dim lngLastSpace As Long
> 
> For lngLoopCount = 1 To Len(InputString)
> lngPointer = lngPointer + 1
> If Mid(InputString, lngLoopCount, 1) = " " Then
> lngLastSpace = lngLoopCount
> lngLastPointer = lngPointer
> End If
> If lngPointer > MaxChars And lngLastPointer <> 0 Then
> Mid(InputString, lngLastSpace, 1) = Chr$(10)
> lngPointer = MaxChars - lngLastPointer + 1
> End If
> Next
> WordWrap = Replace(InputString, Chr$(10), vbCrLf)
> End Function
> 
> 
> 
> --
> Stuart
> 
> 
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 



-- 
-Francisco
http://pcthis.blogspot.com |PC news with out the jargon!
http://sqlthis.blogspot.com | Tsql and More...



More information about the AccessD mailing list