Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Data File, make change and save

Status
Not open for further replies.
May 5, 2000
168
US
I'm a new VB programmer.

I need to open a data file that contains the "*" symbol throughout the document. I need to remove these symbols and then save the data file.

Can anyone help. Also, is there a good site for viewing code samples anyone can suggest.

Thanks
 
you can do it to read the datafile (File Open etc,read all lines) and then with this functie you can move the "*" :

Public Function ReplaceAll(searchstring As String, _
findstring As String, replacestring As String) As String
Dim curpos As Long
curpos = 1
Do
curpos = InStr(curpos, searchstring, findstring)
searchstring = Left$(searchstring, curpos - 1) & _
replacestring & Right$(searchstring, Len(searchstring) _
- curpos - Len(findstring) + 1)
Loop Until InStr(searchstring, findstring) = 0
ReplaceAll = searchstring
End Function

Dim Result As String

Result =ReplaceAll("*", " ")

End Sub

Eric De Decker
vbg.be@vbgroup.nl

Licence And Copy Protection AxtiveX
Source CodeBook for the programmer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top