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!

Replace function update

Status
Not open for further replies.
May 5, 2000
168
US
I have a little vb program that looks for an "*" symbol in a .dat file and replaces it with a "-". It is envolked with a click event.

I need to revise this code to look for a text string "CH.NUM" in the file, on the next line there will be a series of numbers with a "*" in the string. I need to replace the "*" with a "-".

I also need to look for this file on one mapped drive, make the change, cut the file and copy it to another drive.

This application needs to run every five minutes in the background.

I have my original code below, if anyone could help me with this I'd really appreciate it.


Private Sub CmdData_Click()
Open "a:\test.dat" For Input As #1
Open "a:\testout.dat" For Output As #2

Dim intResponse As Integer

Do Until EOF(1)
Line Input #1, strInput
newstring = Replace(strInput, "*", "-")
Print #2, newstring
Loop

Close #1
Close #2

intResponse = MsgBox("The text has been updated, Exit?", _
vbYesNo + vbQuestion, "Exit Application")
If intResponse = vbYes Then

Unload frmWrite

End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top