Solved

How do you Delete Vbcrlf from a string?

Posted on 1998-12-04
2
307 Views
Last Modified: 2008-03-10

How do you Delete all VbCrLf from a string?
0
Comment
Question by:vbvpg
2 Comments
 
LVL 3

Accepted Solution

by:
traygreen earned 20 total points
ID: 1448260
You can look for it using instr and then mid it out.
vbcrlf is a two character string comprised of ASCII chars 10 & 13

   Dim iCRLFPos As Integer
   
   iCRLFPos = InStr(1, Text1.Text, vbCrLf)
   If iCRLFPos > 0 Then
      If iCRLFPos = 1 Then
         Text1.Text = Mid(Text1.Text, 2)
      Else
         Text1.Text = Mid(Text1.Text, 1, iCRLFPos - 1) & Mid(Text1.Text, iCRLFPos + 2)
      End If
   End If

0
 
LVL 1

Expert Comment

by:muffinthedog
ID: 1448261
?
While InStr(str, vbCrLf)
    str = Left(str, InStr(str, vbCrLf) - 1) & Right(str, Len(str) - InStr(str, vbCrLf) - 1)
Wend

0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question