Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


remove specific characters from a string

remove specific characters from a string

remove specific characters from a string

I want to progam a button to remove the backslashes from a text-formatted copy of a date-formatted field.  The visual basic REMOVE method doesn't seem to work in FormDocs.   

RE: remove specific characters from a string

Here is one way to do I think what your looking for.  This is an adaption from a previous post by goofyguy on this forum.


Function replace(entire As String,lookfor As String,replacewith As String)
 Dim I As Integer
 Dim leftpart As String
 lookfor = "/"
 I = 1
 Do While true
 I = Instr(1,entire,lookfor)
 If I = 0 Then
 Exit Do
 leftpart = left(entire, I -1)
 entire = leftpart & replacewith & right(entire, len (entire) - len(lookfor) - len(leftpart))
 End If
 replace = entire
End Function

Function Remove(strtxt As String)
 Dim strchar As String
 Dim intPos As Long
 strchar ="/"
 For intPos = 1 To len(strtxt)
 strtxt = replace(strtxt, mid(strchar, intPos,1), "")
 Remove = strtxt
End Function

Next Call your function using a button (or whatever) by :

Attached is a sample for clarification.

Hope this starts you in the right direction.


RE: remove specific characters from a string

Further thoughts on the solution:  interesting.  What if one wanted to remove a set of characters from a field?  Like removing colon and space and AM or PM in copying infromation from a time formated field.  Would you do something like:

Start Loop
pick first character from an array
run the remove and replace funtions
restart loop, picking next character from the array
run the funtions, etc.

Could this be packaged as  DLL?


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close